| Question 1 void reshape(int w,int h) {glViewport(0,0,w,h);
 glMatrixMode(GL_PROJECTION);
 glLoadIdentity();
 gluPerspective(10.0,(float) w/h,30.0,150.0);
 glMatrixMode(GL_MODELVIEW);
 glLoadIdentity();
 gluLookAt(0.0,25.0,40.0,10.0,10.0,10.0,1.0,1.0,0.0);
 }
 Question 2 a) Utilisation d'un tableau de 4x4
    float. typedef float matrice[4][4]; b) Deux matrices en entrée, une
    matrice en sortie. La fonction est conçue pour fonctionner même si la matrice en sortie
    est l'une des deux matrices en entrée (pas d'effet de bord). void
    produitMatriceMatrice(matrice a,matrice b,matrice r) {matrice rr;
 int i,j;
 for ( i = 0 ; i < 4 ; i++ )
 for ( j = 0 ; j < 4 ; j++ ) {
 rr[i][j] = 0.0F;
 for ( int k = 0 ; k < 4 ; k++ ) {
 rr[i][j] += a[i][k]*b[k][j]; } }
 for ( i = 0 ; i < 4 ; i++ )
 for ( j = 0 ; j < 4 ; j++ )
 r[i][j] = rr[i][j];
 }
 Question 3   
 Question 4 Fichier Objets.wrl #VRML V1.0 asciiSeparator {
 Separator {
 Material {
 diffuseColor 1 0 0
 specularColor 0 0 0
 ambientColor 0 0 0 }
 Translation {
 translation 3 0 0 }
 Cube { } }
 Separator {
 Material {
 diffuseColor 0 1 0
 specularColor 0 0 0
 ambientColor 0 0 0 }
 Sphere { } }
 Separator {
 Material {
 diffuseColor 0 0 1
 specularColor 0 0 0
 ambientColor 0 0 0 }
 Translation {
 translation -3 0 0 }
 Cylinder { } }
 } 
 Fichier Lignes.wrl #VRML V1.0 asciiSeparator {
 DEF Objets Separator {
 Translation {
 translation 0 3 0 }
 WWWInline {
 name "Objets.wrl"
 bboxSize 8 2 2 } }
 Rotation {
 rotation 0 0 1 3.14159 }
 USE Objets
 }
   
 |