Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Sep 18th, 2013  |  syntax: None  |  size: 0.54 KB  |  views: 31  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include <GL/glut.h>
  2.  
  3. void
  4. reshape(int w, int h)
  5. {
  6.     glViewport(0, 0, w, h);
  7.     glMatrixMode(GL_PROJECTION);
  8.     glLoadIdentity();
  9.     glOrtho(0, w, 0, h, -1, 1);
  10. }
  11.  
  12. void
  13. display(void)
  14. {
  15.     glClear(GL_COLOR_BUFFER_BIT);
  16.     glBegin(GL_POINTS);
  17.     for (int i = 0; i<399; ++i)
  18.     {
  19.         glVertex2i(i, (i*i)%399);
  20.     }
  21.     glEnd();
  22.     glFlush();
  23. }
  24.  
  25. int
  26. main(int argc, char **argv)
  27. {
  28.     glutInit(&argc, argv);
  29.     glutCreateWindow("some points");
  30.     glutDisplayFunc(display);
  31.     glutReshapeFunc(reshape);
  32.     glutMainLoop();
  33.     return 0;
  34. }