int main(int argc, char const *argv[]) { GLFWwindow* window; glfwSetErrorCallback(error_callback); if(!glfwInit()) return EXIT_FAILURE; #if defined(__APPLE_CC__) 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 glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1); #endif window = glfwCreateWindow(800, 800, "cg-lab", NULL, NULL); if(!window) { glfwTerminate(); exit(EXIT_FAILURE); } glfwMakeContextCurrent(window); #if defined(_MSC_VER) glewExperimental = true; if (glewInit() != GL_NO_ERROR) { glfwTerminate(); exit(EXIT_FAILURE); } #endif glfwSetKeyCallback(window, key_callback); initialize_shader(); check(__LINE__); initialize_vao(); check(__LINE__); initialize_texture(); check(__LINE__); while(!glfwWindowShouldClose(window)) { draw(window); check(__LINE__); glfwSwapBuffers(window); glfwPollEvents(); } destroy_vao(); check(__LINE__); destroy_shader(); check(__LINE__); destroy_texture(); check(__LINE__); glfwDestroyWindow(window); glfwTerminate(); return EXIT_SUCCESS; }
void piglit_init(int argc, char **argv) { piglit_require_extension("GL_ARB_framebuffer_object"); piglit_require_extension("GL_ARB_texture_barrier"); piglit_require_GLSL_version(130); width = 256; height = 128; initialize_program(); initialize_texture(); initialize_fbo(); glViewport(0, 0, width, height); }