Advertisement
xerpi

glfw

Aug 30th, 2013
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.79 KB | None | 0 0
  1. #include <GLFW/glfw3.h>
  2. #include <stdlib.h>
  3. #include <stdio.h>
  4.  
  5.  
  6. int main(void)
  7. {
  8.     GLFWwindow* window;
  9.     if (!glfwInit())
  10.         exit(EXIT_FAILURE);
  11.     window = glfwCreateWindow(640, 480, "Simple example", NULL, NULL);
  12.     if (!window) {
  13.         glfwTerminate();
  14.         exit(EXIT_FAILURE);
  15.     }
  16.  
  17.     glfwMakeContextCurrent(window);
  18.     while (!glfwWindowShouldClose(window))
  19.     {
  20.         glClear(GL_COLOR_BUFFER_BIT);
  21.         glBegin(GL_TRIANGLES);
  22.             glColor3f(1.f, 0.f, 0.f);
  23.         glVertex3f(-0.6f, -0.4f, 0.f);
  24.         glColor3f(0.f, 1.f, 0.f);
  25.         glVertex3f(0.6f, -0.4f, 0.f);
  26.         glColor3f(0.f, 0.f, 1.f);
  27.         glVertex3f(0.f, 0.6f, 0.f);
  28.         glEnd();
  29.         glfwSwapBuffers(window);
  30.     }
  31.     glfwDestroyWindow(window);
  32.     glfwTerminate();
  33.     exit(EXIT_SUCCESS);
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement