Fichier source : Animation3.cpp
/* Fonction executee lors d'un rafraichissement */
/* de la fenetre de dessin */
static void display(void) {
glClearColor(0.25F,0.25F,0.25F,0.25F);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
gluLookAt(20.0,30.0,60.0,0.0,0.0,0.0,0.0,1.0,0.0);
glLightfv(GL_LIGHT0,GL_POSITION,light0_position);
glLightfv(GL_LIGHT1,GL_POSITION,light1_position);
glLightfv(GL_LIGHT2,GL_POSITION,light2_position);
damier();
glRotatef(-image,0.0F,1.0F,0.0F);
glTranslatef(0.0F,0.0F,15.0F);
mobile(image/10.0F);
glPopMatrix();
glFlush();
glutSwapBuffers();
int error = glGetError();
if ( error != GL_NO_ERROR )
printf("Attention erreur %d\n",error);
}
/* Fonction executee lorsqu'aucun evenement */
/* n'est en file d'attente */
static void idle(void) {
image++;
glutPostRedisplay();
}