コード例 #1
0
int orig_main(int argc, char ** argv)
{
    initOsd();
    return 0;
}
コード例 #2
0
ファイル: main.cpp プロジェクト: RachidElGuerrab/OpenSubdiv
int main(int /* argc */, char ** /* argv */) 
{
    // 
    // Setup GLFW, glew and some initial GL state
    //
    static const char windowTitle[] = "CPU Subdivision Example";

    if (not glfwInit()) {
        printf("Failed to initialize GLFW\n");
        return 1;
    }
    
#define CORE_PROFILE
#ifdef CORE_PROFILE
    setGLCoreProfile();
#endif

    #if GLFW_VERSION_MAJOR>=3
        if (not (g_window=glfwCreateWindow(g_width, g_height, windowTitle, NULL, NULL))) {
            printf("Failed to open window.\n");
            glfwTerminate();
            return 1;
        }
        glfwMakeContextCurrent(g_window);

        // accommodate high DPI displays (e.g. mac retina displays)
        glfwGetFramebufferSize(g_window, &g_width, &g_height);
        glfwSetFramebufferSizeCallback(g_window, reshape);

        glfwSetWindowCloseCallback(g_window, windowClose);
    #else
        if (glfwOpenWindow(g_width, g_height, 8, 8, 8, 8, 24, 8, GLFW_WINDOW) == GL_FALSE) {
            printf("Failed to open window.\n");
            glfwTerminate();
            return 1;
        }
        glfwSetWindowTitle(windowTitle);
        glfwSetWindowSizeCallback(reshape);
        glfwSetWindowCloseCallback(windowClose);
    #endif

    

#if defined(OSD_USES_GLEW)
#ifdef CORE_PROFILE
    // this is the only way to initialize glew correctly under core profile context.
    glewExperimental = true;
#endif
    if (GLenum r = glewInit() != GLEW_OK) {
        printf("Failed to initialize glew. Error = %s\n", glewGetErrorString(r));
        exit(1);
    }
#ifdef CORE_PROFILE
    // clear GL errors which was generated during glewInit()
    glGetError();
#endif
#endif

    initOsd();
    
    //
    // Start the main drawing loop
    //
    while (g_running) {
        idle();
        display();
        
#if GLFW_VERSION_MAJOR>=3
        glfwPollEvents();
        glfwSwapBuffers(g_window);
#else
        glfwSwapBuffers();
#endif
        
        glFinish();
    }
}