-
Notifications
You must be signed in to change notification settings - Fork 0
/
pentagon.cpp-2.enc
58 lines (53 loc) · 1.28 KB
/
pentagon.cpp-2.enc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include<windows.h>
#include <stdio.h>
#include <GL/glut.h>
#include<math.h>
float b=120,j,i,l;
int m;
void display()
{
b+=0.1;
glClear(GL_COLOR_BUFFER_BIT);
glLoadIdentity();
glRotatef(130,1,0,0);
glRotatef(b,0,0,1);
GLUquadricObj *temp=gluNewQuadric();
glColor3f(0,1,1);
glPushMatrix();
glTranslatef(0,0,0.55);
gluDisk(temp,0,600,50,30);
gluCylinder(temp,600,600,50,30,30);
glPopMatrix();
for(i=0.5,j=500,m=20,l=0.5;i>=-0.70;i=i-0.05,j=j-30,m=(m+20)%360,l=l+0.02)
{
glPushMatrix();
glColor3f(0,l,l);
glTranslatef(0,0,i);
glRotatef(m,0,0,1);
gluDisk(temp,0,j,5,10);
gluCylinder(temp,j,j,50,5,10);
glPopMatrix();
}
glutSwapBuffers();
glutPostRedisplay();
glFlush();
}
void init(void)
{
glClearColor(0,0,0,0);
glOrtho(-1000,1000,-1000,1000,-1000,1000);
glMatrixMode(GL_MODELVIEW);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
}
int main(int argc, char *argv[])
{
glutInit(&argc, argv);
init();
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
glutInitWindowSize(600,600);
glutCreateWindow("pentagon");
init();
glutDisplayFunc(display);
glutMainLoop();
}