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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
|
void affichage()
{
/******************Declaration des variables**************************/
/* */
/* */
double alt;
float a1,b1,c1,z,x0,y0,z0,x1,y1,z1,x2,y2,z2,x3,y3,z3;
/****************** OPENGL **************************/
/* */
/* */
glLoadIdentity();
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glEnable(GL_DEPTH_TEST) ;
glShadeModel(GL_SMOOTH);
zmouvant=determine_z((-axex+4050),(-axey+4050));
zmouvant=zmouvant+50;
qd_bord_fenetre_dpcmt(Xsouris,Ysouris);
float m1,m2,m3;
float zmouv=zmouvant ;
/*texture*/
glBindTexture(GL_TEXTURE_2D, texture[0]);
float xtext,ytext,xtext1,ytext1,xtext2,ytext2,xtext3,ytext3;
/*recuperation et tracage des points*/
for( int i=0;i<79;i++){
for(int j=0;j<79;j++){
alt=mntab[i][j];
x0=(i*100-4050+axex);
y0=(j*100-4050+axey);
z0=(mntab[i][j]-zmouvant); //on recal l'origine
Angles_Euler(rotx, roty, rotz,x0 , y0, z0);//quaternions
x1=((i)*100-4050+axex);
y1=((j+1)*100-4050+axey);
z1=(mntab[i][j+1]-zmouvant); //on recal l'origine
Angles_Euler(rotx, roty, rotz,x1 , y1, z1 );
x2=((i+1)*100-4050+axex);
y2=((j)*100-4050+axey);
z2=(mntab[i+1][j]-zmouvant); //on recal l'origine
Angles_Euler(rotx, roty, rotz,x2 , y2, z2 );
x3=((i+1)*100-4050+axex);
y3=((j+1)*100-4050+axey);
z3=(mntab[i+1][j+1]-zmouvant); //on recal l'origine
Angles_Euler( rotx, roty, rotz,x3 , y3, z3);
/*GESTION DES TEXTURES*/
xtext=(i/79.);/*pourcentage de la texture a plaquer*/
ytext=(j/79.);
xtext1=(i/79.);
ytext1=((j+1)/79.);
xtext2=((i+1)/79.);
ytext2=(j/79.);
xtext3=((i+1)/79.);/*pourcentage de la texture a plaquer*/
ytext3=((j+1)/79.);
//tracage
glColor3f(1.0,1.0,1.0);
glBegin(GL_QUADS);
glTexCoord2f(xtext,ytext);
//glTexCoord2f(0,1);
glVertex3f((x0),z0,(y0)) ;
glTexCoord2f(xtext1,ytext1);
//glTexCoord2f(1,1);
glVertex3f((x1),z1,(y1)) ;
glTexCoord2f(xtext3,ytext3);
//glTexCoord2f(1,0);
glVertex3f((x3),z3,(y3)) ;
glTexCoord2f(xtext2,ytext2);
//glTexCoord2f(0,0);
glVertex3f((x2),z2,(y2)) ;
glEnd() ;
}//i
}//j
glDisable(GL_DEPTH_TEST) ;
glPopMatrix();
glFlush();
glutSwapBuffers();
} |
Partager