Rapprochement de la caméra de visualisation |
Diminution de l'angle d'ouverture verticale |
Ajustement de la taille de la scène |
Fichier source : ParametragesGLUt2-1.cpp
/* Fonction executee lors d'un changement */
/* de la taille de la fenetre OpenGL */
static void reshape(int x,int y) {
glViewport(0,0,x,y);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(80.0F,(float) x/y,1.0,40.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0.0,0.0,7.0,
0.0,0.0,0.0,
0.0,1.0,0.0);
}
Fichier source : ParametragesGLUt2-2.cpp
/* Fonction executee lors d'un changement */
/* de la taille de la fenetre OpenGL */
static void reshape(int x,int y) {
glViewport(0,0,x,y);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(25.0F,(float) x/y,1.0,40.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0.0,0.0,20.0,
0.0,0.0, 0.0,
0.0,1.0, 0.0);
}
Fichier source : ParametragesGLUt2-3.cpp
/* Fonction executee lors d'un rafraichissement */
/* de la fenetre de dessin */
static void display(void) {
glClearColor(0.3F,0.3F,0.3F,0.5F);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
const GLfloat light0_position[] = { 0.0,0.0,0.0,1.0 };
const GLfloat light1_position[] = { -1.0,1.0,1.0,0.0 };
const GLfloat light2_position[] = { 1.0,-1.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);
glPushMatrix();
glRotatef(r0,1.0F,0.0F,0.0F);
glRotatef(r1,0.0F,1.0F,0.0F);
glRotatef(r2,0.0F,0.0F,1.0F);
glScalef(2.8F,2.8F,2.8F);
scene();
glPopMatrix();
glFlush();
glutSwapBuffers();
int error = glGetError();
if ( error != GL_NO_ERROR )
printf("Attention erreur %d\n",error);
}
/* Fonction executee lors d'un changement */
/* de la taille de la fenetre OpenGL */
static void reshape(int x,int y) {
glViewport(0,0,x,y);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(80.0F,(float) x/y,1.0,40.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0.0,0.0,20.0,
0.0,0.0, 0.0,
0.0,1.0, 0.0);
}