int main( int argc, char* args[] ) { Render render; render.init(); int i = 0; while(render.running) { render.event(); render.draw(); if((render.checkNow)&&(i == render.speed)) { render.check(); } i++; if(i > render.speed) i = 0; } //Quit SDL SDL_Quit(); return 0; }
int main(void) { GLFWwindow* window; if (glfwInit()) { glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); } else { exit(EXIT_FAILURE); } window = glfwCreateWindow(640, 480, "App", NULL, NULL); if (window) { glfwMakeContextCurrent(window); glfwSetKeyCallback(window, glfwKeyCallback); glfwSwapInterval(1); } else { glfwTerminate(); exit(EXIT_FAILURE); } Render render; render.setup("lib"); isRunning = true; printf("GL Version %s\n", glGetString(GL_VERSION)); while (isRunning && !glfwWindowShouldClose(window)) { render.update(); render.draw(); glfwSwapBuffers(window); glfwPollEvents(); } glfwDestroyWindow(window); glfwTerminate(); return 0; }