1
1
#include < GL/glut.h>
2
2
#include < stdlib.h>
3
3
GLfloat T = 0 ;
4
- // void Spin()
5
- // {
6
- // T = T + 0.03;
7
- // if(T>360)
8
- // T = 0;
9
- // glutPostRedisplay();
10
- // }
11
4
void MyInit () {
12
5
glClearColor (0 , 0 , 0 , 1 );
13
6
glColor3f (1 , 0 , 0 );
@@ -27,15 +20,15 @@ void Cube(GLfloat V0[], GLfloat V1[], GLfloat V2[], GLfloat V3[], GLfloat V4[],
27
20
glColor3f (0.6 , 0 , 0.6 );
28
21
Face (V0, V1, V2, V3);// back
29
22
glColor3f (0.5 , 0.9 , 0.5 );
30
- Face (V4, V5, V6, V7);// front
23
+ Face (V4, V5, V6, V7);
31
24
glColor3f (1 , 0.4 , 0 );
32
- Face (V0, V3, V7, V4);// left
25
+ Face (V0, V3, V7, V4);
33
26
glColor3f (1 , 0.5 , 1 );
34
- Face (V1, V2, V6, V5);// right
27
+ Face (V1, V2, V6, V5);
35
28
glColor3f (0.5 , 0.6 , 1 );
36
- Face (V0, V1, V5, V4);// top
29
+ Face (V0, V1, V5, V4);
37
30
glColor3f (0.5 , 0.4 , 1 );
38
- Face (V2, V3, V7, V6);// bottom
31
+ Face (V2, V3, V7, V6);
39
32
}
40
33
void Draw () {
41
34
GLfloat V[8 ][3 ] = { {-0.2 , 0.2 , 0.3 },
@@ -86,13 +79,11 @@ void Draw() {
86
79
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
87
80
88
81
glLoadIdentity ();
89
- // glRotatef(T,1,1,1);//for spinning
90
- glRotatef (3 , 1 , 1 , -1 );// for stationary
82
+ glRotatef (3 , 1 , 1 , -1 );
91
83
Cube (V[0 ], V[1 ], V[2 ], V[3 ], V[4 ], V[5 ], V[6 ], V[7 ]);
92
84
Cube (V1[0 ], V1[1 ], V1[2 ], V1[3 ], V1[4 ], V1[5 ], V1[6 ], V1[7 ]);
93
85
Cube (V2[0 ], V2[1 ], V2[2 ], V2[3 ], V2[4 ], V2[5 ], V2[6 ], V2[7 ]);
94
86
Cube (V3[0 ], V3[1 ], V3[2 ], V3[3 ], V3[4 ], V3[5 ], V3[6 ], V3[7 ]);
95
- // Cube(V4[0], V4[1], V4[2], V4[3], V4[4], V4[5], V4[6], V4[7]);
96
87
97
88
glutSwapBuffers ();
98
89
}
@@ -107,7 +98,6 @@ int main(int C, char* V[])
107
98
glutCreateWindow (" PRATIMA" );
108
99
MyInit ();
109
100
glutDisplayFunc (Draw);
110
- // glutIdleFunc(Spin); //spinning
111
101
glutMainLoop ();
112
102
113
103
return 0 ;
0 commit comments