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
| float angle_x=0.0,angle_y=0.0;
float dppx = 0.5625;
float dppy = 0.375;
float y = 2.0;
float z = 99.0;
float x = 2.0;
void
display(void) {
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glColor3f (1.0, 1.0, 1.0);
glLoadIdentity();
glTranslatef(-x, -y, -z);
glRotatef(angle_y, 1.0, 0.0, 0.0);
glRotatef(angle_x, 0.0, 1.0, 0.0);
dessinerCiel();
dessinerPoligone();
dessinerPlafond();
dessinerMurs();
glutSwapBuffers();
}
/// souris evenement
void mouse_motion(int _x, int _y) {
angle_x = (float)_x*dppx - 180.0;
angle_y = (float)_y*dppy - 90.0;
//printf("angle x : %f, angle y %f",angle_x,angle_y);
if(angle_y<MINY)angle_y=MINY;
if(angle_y>MAXY)angle_y=MAXY;
glutPostRedisplay();
} |
Partager