summaryrefslogtreecommitdiff
path: root/c/opengl.c
blob: 9504fcec3b0c36adff57d7b44d253ea1ca5b53fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <GLFW/glfw3.h>
#include <stdio.h>

int main() {
  glfwInit();

  GLFWwindow* window = glfwCreateWindow(400, 400, "baller", NULL, NULL);
  glfwMakeContextCurrent(window);

  while (!glfwWindowShouldClose(window)) {
    glClear(GL_COLOR_BUFFER_BIT);

    glBegin(GL_QUADS);
      glVertex2f(-0.5f, -0.5f);
      glVertex2f( 0.5f, -0.5f);
      glVertex2f( 0.5f,  0.5f);
      glVertex2f(-0.5f,  0.5f);
    glEnd();

    glfwSwapBuffers(window);
    glfwPollEvents();
  }

  glfwTerminate();
  return 0;
}