Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 1st, 2012  |  syntax: C  |  size: 0.70 KB  |  hits: 25  |  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 <stdio.h>
  2. #include <GL/gl.h>
  3. #include <GL/glut.h>
  4.  
  5. #define KEY_ESCAPE 27
  6.  
  7. void display();
  8.  
  9. int main(int argc, char **argv) {
  10.     glutInit(&argc, argv);                                    
  11.     glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
  12.     glutInitWindowSize(600,400);                                 
  13.     glutCreateWindow("Opengl Test");                                             
  14.     glutDisplayFunc(display);
  15.     glutMainLoop();
  16.     return 0;
  17. }
  18. void display() {
  19.         float x,y,z;
  20.         int i;
  21.     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);              
  22.     glLoadIdentity();
  23.     glColor3f(1,1,0);
  24.     glBegin(GL_POINT);
  25.     x=0;
  26.     y=0;
  27.     z=0;
  28.         for(i=0;i<200;i++) {
  29.                 glVertex3f(x,y,z);
  30.                 x=x+0.5;               
  31.         }
  32.         glEnd();
  33. }