#include #include #include "die.h" void resize_handler(GLFWwindow* window, int width, int height) { glViewport(0, 0, width, height); } int main(int argc, char** argv) { glfwInit(); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); int width = 800, height = 600; GLFWwindow* window = glfwCreateWindow(width, height, "vis", NULL, NULL); if (window == NULL) { glfwTerminate(); die("error: could not create window\n"); } glfwMakeContextCurrent(window); glfwSetFramebufferSizeCallback(window, resize_handler); resize_handler(window, width, height); while (!glfwWindowShouldClose(window)) { glClearColor(1.f, 0.f, 1.f, 1.0f); glClear(GL_COLOR_BUFFER_BIT); glfwSwapBuffers(window); } glfwTerminate(); return EXIT_SUCCESS; }