5 #include "opengl/opengl.h"
7 extern GLFWwindow *win;
11 static void clear(float r, float g, float b);
12 static void viewport(int x, int y, int width, int height);
17 fprintf(stderr, "Failed to initialize GLFW.\n");
21 glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
22 glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 5);
23 glfwWindowHint(GLFW_SRGB_CAPABLE, GLFW_TRUE);
25 if(!(win = glfwCreateWindow(win_w, win_h, "glcow", 0, 0))) {
26 fprintf(stderr, "Failed to create window.\n");
29 glfwMakeContextCurrent(win);
33 glEnable(GL_DEPTH_TEST);
34 glEnable(GL_CULL_FACE);
35 glEnable(GL_FRAMEBUFFER_SRGB); // linear colorspace
38 gfx_viewport = viewport;
46 glfwDestroyWindow(win);
51 static void clear(float r, float g, float b)
53 glClearColor(r, g, b, 1.0);
54 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
57 static void viewport(int x, int y, int width, int height)
59 glViewport(x, y, width, height);