예제 #1
0
파일: main.cpp 프로젝트: bhlzlx/graphics
int main(int argc,char ** argv)
{
    // start GL context and O/S window using the GLFW helper library
    appDelegate.AppWillStart();
    FPS_Helper fpsHelper;
    fpsHelper.SetFixedFPS(30);
    InitOpenGL();

    appDelegate.AppDidStart();

    while (!glfwWindowShouldClose (mainWnd.window))
    {
        // wipe the drawing surface clear
        static double timer_last = 0;
        double curr_time = glfwGetTime();
        if(curr_time - timer_last > 0.2)
        {
            timer_last = timer_last + 0.02;
            OnTimer();
        }

        if(fpsHelper.Tick())
        {
            OnRender();
            // update other events like input handling
            glfwPollEvents ();
            // put the stuff we've been drawing onto the display
            glfwSwapBuffers (mainWnd.window);
        }
    }
    // close GL context and any other GLFW resources
    appDelegate.AppWillTerminate();
    glfwTerminate();
    return 0;
}