Thursday, May 15, 2014

Opengl,C++ : Drawing Points

1:  #include<GL/glut.h>  
2:  void init(){  
3:  }  
4:  void display(void)  
5:  {  
6:       glClear(GL_COLOR_BUFFER_BIT);  
7:       glPointSize(5.0);  
8:       glBegin(GL_POINTS);       
9:            glColor3f(1.0,1.0,0.0);  
10:            glVertex2f(-0.5,-0.5);  
11:            glColor3f(0.5,1.0,0.8);  
12:            glVertex2f(0.5,-0.5);  
13:            glColor3f(1.0,0.2,0.0);  
14:            glVertex2f(0.5,0.5);  
15:            glColor3f(1.0,0.2,0.0);  
16:            glVertex2f(0.1,0.9);  
17:       glEnd();  
18:       glFlush();  
19:  }  
20:  int main(int argc,char** argv)  
21:  {  
22:       glutCreateWindow("Draw Points");  
23:       glutDisplayFunc(display);  
24:       init();  
25:       glutMainLoop();  
26:  }  

No comments:

Post a Comment