Advertisement
xerpi

caloh caloh´aáá

Sep 1st, 2013
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.77 KB | None | 0 0
  1. #include <GLFW/glfw3.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <math.h>
  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.     glfwMakeContextCurrent(window);
  17.     float inval = 0.0f;
  18.     glClearColor(0,0,0,0);
  19.     glClear(GL_COLOR_BUFFER_BIT);
  20.    
  21.     while (!glfwWindowShouldClose(window))
  22.     {
  23.             glColor3f(1,1,1);
  24.             glBegin(GL_POINTS);
  25.                 glVertex2f(-1.0f + inval/5.0f, sinf(inval));
  26.             glEnd();
  27.             glfwSwapBuffers(window);
  28.             glfwPollEvents();
  29.             inval += 0.01f;
  30.     }
  31.    
  32.     glfwDestroyWindow(window);
  33.     glfwTerminate();
  34.     exit(EXIT_SUCCESS);
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement