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
|
void CubeDisplay(void) {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//sets the viweport and the projection
my_viewport(S,S,Proj);
//Maj position camera
CameraView();
//opérations de translations et rotation
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glTranslatef (-cube.x, -cube.y, -cube.z ) ; //3
glRotatef (cube.angle_y, 0, 1, 0); //2
glRotatef (cube.angle_x, 1, 0, 0); //1
//vertices
glBegin(GL_QUADS);
//on dessine le cube ...
...
glEnd();
glPopMatrix(); //restore camera matrix
/********************/
glFlush();
glutSwapBuffers ();
} |
Partager