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: //glBegin(GL_TRIANGLES);
10: glBegin(GL_POLYGON);
11: glColor3f(1.0,1.0,0.0);
12: glVertex2f(-0.5,-0.5);
13: glColor3f(0.5,1.0,0.8);
14: glVertex2f(0.5,-0.5);
15: glColor3f(1.0,0.2,0.0);
16: glVertex2f(0.5,0.5);
17: glColor3f(1.0,0.2,0.0);
18: glVertex2f(0.1,0.9);
19: glEnd();
20: glFlush();
21: }
22: int main(int argc,char** argv)
23: {
24: glutCreateWindow("Draw Polygon");
25: glutDisplayFunc(display);
26: init();
27: glutMainLoop();
28: }
Thursday, May 15, 2014
Opengl,C++ : Drawing Polygon
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment