packages/pyglGA/scripts/basicTriangle.py
def main():
    """
    The main method that after calling init() it starts the main rendering loop.
    This loop re-draws an ImGUI sample window in immediate mode and swaps the SDL2 double buffer windows
    """
    
    gWindow, gContext, gVersionLabel = init()
    #ImGui.create_default_context(purpose=Purpose.SERVER_AUTH, cafile=None, capath=None, cadata=None)
    imguiContext = ImGui.create_context()
    
    if imguiContext is None:
        print("Window could not be created! ImGUI Error: ")
        exit(1)
    else:
        print("Yay! ImGUI context created successfully")
        
    renderer = SDL2Renderer(gWindow)
    
    # Enable depth test
    glEnable(GL_DEPTH_TEST)
    # Accept fragment if it closer to the camera than the former one
    glDepthFunc(GL_LESS)
    # Setup GL shaders, data, etc.
    initTriangle()

    running = True
    # MAIN LOOP
    while running:
        events = sdl2.ext.get_events()
        for event in events:
            if event.type == SDL_KEYDOWN:
                if event.key.keysym.sym == SDLK_ESCAPE:
                    running = False
            if event.type == SDL_QUIT:
                running = False
            renderer.process_event(event)
        renderer.process_inputs()

        glClearColor(0.0, 0.0, 0.0, 1)
        glClear(GL_COLOR_BUFFER_BIT)

        ImGui.set_next_window_size(300.0, 150.0)
        # start new frame context
        ImGui.new_frame()
        # open new window context
        ImGui.begin("Our first window!", True)
        # draw text label inside of current window
        ImGui.text("PyImgui + PySDL2 integration successful!")
        ImGui.text(gVersionLabel)
        # close current window context
        ImGui.end()
        
        #render the shader-based triangle in each frame, before any ImGUI widget
        displayTriangle()
        
        # pass all ImGUI drawing commands to the rendering pipeline
        # and close ImGUI frame context
        ImGui.render() #always draw last ImGUI
        renderer.render(ImGui.get_draw_data())

        SDL_GL_SwapWindow(gWindow)
    # CLOSING
    renderer.shutdown()
    SDL_GL_DeleteContext(gContext)
    SDL_DestroyWindow(gWindow)
    SDL_Quit()

    The main method that after calling init() it starts the main rendering loop.
    This loop re-draws an ImGUI sample window in immediate mode and swaps the SDL2 double buffer windows
    
The main method that after calling init() it starts the main rendering loop.
This loop re-draws an ImGUI sample window in immediate mode and swaps the SDL2 double buffer windows
The main method that after calling init () it starts the main rendering loop . This loop re - draws an ImGUI sample window in immediate mode and swaps the SDL2 double buffer windows
def main():
    gWindow, gContext, gVersionLabel = init()
    imguiContext = ImGui.create_context()
    if imguiContext is None:
        print("Window could not be created! ImGUI Error: ")
        exit(1)
    else:
        print("Yay! ImGUI context created successfully")
    renderer = SDL2Renderer(gWindow)
    glEnable(GL_DEPTH_TEST)
    glDepthFunc(GL_LESS)
    initTriangle()
    running = True
    while running:
        events = sdl2.ext.get_events()
        for event in events:
            if event.type == SDL_KEYDOWN:
                if event.key.keysym.sym == SDLK_ESCAPE:
                    running = False
            if event.type == SDL_QUIT:
                running = False
            renderer.process_event(event)
        renderer.process_inputs()
        glClearColor(0.0, 0.0, 0.0, 1)
        glClear(GL_COLOR_BUFFER_BIT)
        ImGui.set_next_window_size(300.0, 150.0)
        ImGui.new_frame()
        ImGui.begin("Our first window!", True)
        ImGui.text("PyImgui + PySDL2 integration successful!")
        ImGui.text(gVersionLabel)
        ImGui.end()
        displayTriangle()
        ImGui.render() 
        renderer.render(ImGui.get_draw_data())
        SDL_GL_SwapWindow(gWindow)
    renderer.shutdown()
    SDL_GL_DeleteContext(gContext)
    SDL_DestroyWindow(gWindow)
    SDL_Quit()
def main ( ) : gWindow , gContext , gVersionLabel = init ( ) imguiContext = ImGui . create_context ( ) if imguiContext is None : print ( "Window could not be created! ImGUI Error: " ) exit ( 1 ) else : print ( "Yay! ImGUI context created successfully" ) renderer = SDL2Renderer ( gWindow ) glEnable ( GL_DEPTH_TEST ) glDepthFunc ( GL_LESS ) initTriangle ( ) running = True while running : events = sdl2 . ext . get_events ( ) for event in events : if event . type == SDL_KEYDOWN : if event . key . keysym . sym == SDLK_ESCAPE : running = False if event . type == SDL_QUIT : running = False renderer . process_event ( event ) renderer . process_inputs ( ) glClearColor ( 0.0 , 0.0 , 0.0 , 1 ) glClear ( GL_COLOR_BUFFER_BIT ) ImGui . set_next_window_size ( 300.0 , 150.0 ) ImGui . new_frame ( ) ImGui . begin ( "Our first window!" , True ) ImGui . text ( "PyImgui + PySDL2 integration successful!" ) ImGui . text ( gVersionLabel ) ImGui . end ( ) displayTriangle ( ) ImGui . render ( ) renderer . render ( ImGui . get_draw_data ( ) ) SDL_GL_SwapWindow ( gWindow ) renderer . shutdown ( ) SDL_GL_DeleteContext ( gContext ) SDL_DestroyWindow ( gWindow ) SDL_Quit ( )
The main method that after calling init() it starts the main rendering loop.
The main method that after calling init () it starts the main rendering loop .
"""
    The main method that after calling init() it starts the main rendering loop.
    This loop re-draws an ImGUI sample window in immediate mode and swaps the SDL2 double buffer windows
    """ #ImGui.create_default_context(purpose=Purpose.SERVER_AUTH, cafile=None, capath=None, cadata=None) # Enable depth test # Accept fragment if it closer to the camera than the former one # Setup GL shaders, data, etc. # MAIN LOOP # start new frame context # open new window context # draw text label inside of current window # close current window context #render the shader-based triangle in each frame, before any ImGUI widget # pass all ImGUI drawing commands to the rendering pipeline # and close ImGUI frame context #always draw last ImGUI # CLOSING