Fichier source : ParametrageCameraB.cpp
/* Fonction executee lors d'un rafraichissement */
/* de la fenetre de dessin */
static void display(void) {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
const GLfloat light0_position[] = { 0.0,0.0,10.0,1.0 };
glPolygonMode(GL_FRONT_AND_BACK,(affichage) ? GL_FILL : GL_LINE);
glPushMatrix();
glLightfv(GL_LIGHT0,GL_POSITION,light0_position);
gluLookAt(0.0,0.0,100.0,0.0,0.0,0.0,0.0,1.0,0.0);
scene();
glPopMatrix();
glFlush();
glutSwapBuffers();
int error = glGetError();
if ( error != GL_NO_ERROR )
printf("Erreur OpenGL: %d\n",error);
}
/* Fonction executee lors d'un changement */
/* de la taille de la fenetre OpenGL */
/* -> Ajustement de la camera de visualisation */
static void reshape(int tx,int ty) {
glViewport(0,0,tx,ty);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
double ratio =(double) tx/ty;
if ( ratio >= 1.0 )
gluPerspective(8.0,ratio,90.0,110.0);
else
gluPerspective(8.0/ratio,ratio,90.0,110.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}