packages/pyglGA/scripts/basicCharacterApp.py
def main():
    """
    The main method that after calling init() it starts the main rendering loop.
    This loop re-draws a shader-based Cube, the ImGUI sample window in immediate mode and finally swaps the SDL2 double buffer windows
    """
    
    #run pyglm tests
    #GLMTests()
    
    global wireFrame
    global windowWidth
    global windowHeight
    global gWindow
    global gContext
    global bgColor
    global depthrenderbuffer
    global Screen_FBO
    global scene

    aflag = 0
    bflag = 0
    cvalue = None
    index = 0
    c = 0
    
    #scene = pyassimp.load(fileNameS, processing=pyassimp.postprocess.aiProcess_Triangulate)
    
    
    gWindow, gContext, gVersionLabel = init()
    
    if USE_MESH_STATIC:
        print('Initializing STATIC_MESH: ',fileNameS)
        initMeshStatic(fileNameS)
    #the model we load
    print("MODEL:" + fileNameS)
    print
    
    #write some statistics
    print("SCENE:")
    print("  meshes:" + str(len(scene.meshes)))
    print("  materials:" + str(len(scene.materials)))
    print("  textures:" + str(len(scene.textures)))
    print
   
    #  Enable depth test
    glEnable(GL_DEPTH_TEST)
    #  Accept fragment if it closer to the camera than the former one
    glDepthFunc(GL_LESS)
    #SDL_WarpMouseInWindow(gWindow, windowWidth // 2, windowHeight // 2)
    
    #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)
    
    event = SDL_Event()
    running = True
    # MAIN LOOP
    while running:
        while SDL_PollEvent(ctypes.byref(event)) != 0:
            event_handler(event)
            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()

         #ImGui.set_next_window_size(300.0, 150.0)
        # start new frame context
        ImGui.new_frame()
        
        camera_move()

        glViewport(0, 0, windowWidth, windowHeight)
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
        glClearColor(*bgColor)

        # bind our frame buffer to write
        # glBindRenderbuffer(GL_RENDERBUFFER, depthrenderbuffer)
        # glBindFramebuffer(GL_FRAMEBUFFER, Screen_FBO)

        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
        glClearColor(*bgColor)
        
        if USE_MESH_STATIC:
            displayMeshStatic()
        
        glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)
        displayGUI()
        
        # 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()
        
        # 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()
    pyassimp.release(scene)
    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 a shader-based Cube, the ImGUI sample window in immediate mode and finally swaps the SDL2 double buffer windows
    
The main method that after calling init() it starts the main rendering loop.
This loop re-draws a shader-based Cube, the ImGUI sample window in immediate mode and finally swaps the SDL2 double buffer windows
The main method that after calling init () it starts the main rendering loop . This loop re - draws a shader - based Cube the ImGUI sample window in immediate mode and finally swaps the SDL2 double buffer windows
def main():
    global wireFrame
    global windowWidth
    global windowHeight
    global gWindow
    global gContext
    global bgColor
    global depthrenderbuffer
    global Screen_FBO
    global scene
    aflag = 0
    bflag = 0
    cvalue = None
    index = 0
    c = 0
    gWindow, gContext, gVersionLabel = init()
    if USE_MESH_STATIC:
        print('Initializing STATIC_MESH: ',fileNameS)
        initMeshStatic(fileNameS)
    print("MODEL:" + fileNameS)
    print
    print("SCENE:")
    print("  meshes:" + str(len(scene.meshes)))
    print("  materials:" + str(len(scene.materials)))
    print("  textures:" + str(len(scene.textures)))
    print
    glEnable(GL_DEPTH_TEST)
    glDepthFunc(GL_LESS)
    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)
    event = SDL_Event()
    running = True
    while running:
        while SDL_PollEvent(ctypes.byref(event)) != 0:
            event_handler(event)
            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()
        ImGui.new_frame()
        camera_move()
        glViewport(0, 0, windowWidth, windowHeight)
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
        glClearColor(*bgColor)
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
        glClearColor(*bgColor)
        if USE_MESH_STATIC:
            displayMeshStatic()
        glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)
        displayGUI()
        ImGui.begin("Our first window!", True)
        ImGui.text("PyImgui + PySDL2 integration successful!")
        ImGui.text(gVersionLabel)
        ImGui.end()
        ImGui.render() 
        renderer.render(ImGui.get_draw_data())
        SDL_GL_SwapWindow(gWindow)
    renderer.shutdown()
    pyassimp.release(scene)
    SDL_GL_DeleteContext(gContext)
    SDL_DestroyWindow(gWindow)
    SDL_Quit()
def main ( ) : global wireFrame global windowWidth global windowHeight global gWindow global gContext global bgColor global depthrenderbuffer global Screen_FBO global scene aflag = 0 bflag = 0 cvalue = None index = 0 c = 0 gWindow , gContext , gVersionLabel = init ( ) if USE_MESH_STATIC : print ( 'Initializing STATIC_MESH: ' , fileNameS ) initMeshStatic ( fileNameS ) print ( "MODEL:" + fileNameS ) print print ( "SCENE:" ) print ( "  meshes:" + str ( len ( scene . meshes ) ) ) print ( "  materials:" + str ( len ( scene . materials ) ) ) print ( "  textures:" + str ( len ( scene . textures ) ) ) print glEnable ( GL_DEPTH_TEST ) glDepthFunc ( GL_LESS ) 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 ) event = SDL_Event ( ) running = True while running : while SDL_PollEvent ( ctypes . byref ( event ) ) != 0 : event_handler ( event ) 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 ( ) ImGui . new_frame ( ) camera_move ( ) glViewport ( 0 , 0 , windowWidth , windowHeight ) glClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ) glClearColor ( * bgColor ) glClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ) glClearColor ( * bgColor ) if USE_MESH_STATIC : displayMeshStatic ( ) glPolygonMode ( GL_FRONT_AND_BACK , GL_FILL ) displayGUI ( ) ImGui . begin ( "Our first window!" , True ) ImGui . text ( "PyImgui + PySDL2 integration successful!" ) ImGui . text ( gVersionLabel ) ImGui . end ( ) ImGui . render ( ) renderer . render ( ImGui . get_draw_data ( ) ) SDL_GL_SwapWindow ( gWindow ) renderer . shutdown ( ) pyassimp . release ( scene ) 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 a shader-based Cube, the ImGUI sample window in immediate mode and finally swaps the SDL2 double buffer windows
    """ #run pyglm tests #GLMTests() #scene = pyassimp.load(fileNameS, processing=pyassimp.postprocess.aiProcess_Triangulate) #the model we load #write some statistics #  Enable depth test #  Accept fragment if it closer to the camera than the former one #SDL_WarpMouseInWindow(gWindow, windowWidth // 2, windowHeight // 2) #ImGui.create_default_context(purpose=Purpose.SERVER_AUTH, cafile=None, capath=None, cadata=None) # MAIN LOOP #ImGui.set_next_window_size(300.0, 150.0) # start new frame context # bind our frame buffer to write # glBindRenderbuffer(GL_RENDERBUFFER, depthrenderbuffer) # glBindFramebuffer(GL_FRAMEBUFFER, Screen_FBO) # open new window context # draw text label inside of current window # close current window context # pass all ImGUI drawing commands to the rendering pipeline # and close ImGUI frame context #always draw last ImGUI # CLOSING