bonjour,

j'ai créé une scène dont voici le code :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
	/* pour gérer seulement la sph  (push et pop) */
	glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
	glShadeModel(GL_SMOOTH);
	glPushMatrix();
		glColor4f(0.1,0.2,1.0,1.0);
		glTranslatef(-0.1,translation,0.0);
		glRotatef(d->spin*d->spin,10.0, 0.0, 1.0);
		glScaled(1.0,sens,1.0);
		glScaled(scale,scale,scale);
		quad=gluNewQuadric(); 
		gluQuadricNormals(quad, GLU_SMOOTH);
		gluQuadricOrientation(quad, GLU_OUTSIDE); 
		gluSphere(quad,0.4,10,10);
	glPopMatrix();
	gluDeleteQuadric(quad);
 
	glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
	glPushMatrix(); 
		glGenTextures(1, &nom_tex);
		glBindTexture(GL_TEXTURE_2D, nom_tex);
		glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
		glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
		glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
		glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
		glTexImage2D(GL_TEXTURE_2D,0,GL_RGB,TAILLE_JPG,TAILLE_JPG,0,GL_RGB,GL_UNSIGNED_BYTE,d->texture2); // que pour des images puissance de 2 mais plus rapide que gluBitmapMachin...
		glColor4f(1.0,1.0,0.0,1.0);
 
		glTranslatef(-0.6,translation,0.0);
		glRotatef(180,0.0, 1.0, 0.0);
		glRotatef(90,0.0, 0.0, 1.0);
		glRotatef(-d->spin,0.0, 1.0, 0.0);
		glScaled(1.0,sens,1.0);
		glScaled(scale,scale,scale);
 
		glBegin(GL_POLYGON); 
			glNormal3f(1.0,0.0,0.0);
			glTexCoord2f(0.0,1.0);   glVertex3f( 0.5, 0.5, 0.0);
			glTexCoord2f(0.0,0.0);   glVertex3f( 0.5,-0.5, 0.0);
			glTexCoord2f(1.0,0.0);   glVertex3f( -0.5,-0.5,-0.0);
			glTexCoord2f(1.0,1.0);   glVertex3f( -0.5, 0.5,-0.0);
		glEnd();
	glPopMatrix();
	glDeleteTextures(1,&nom_tex);
 
	glPushMatrix();
		glGenTextures(1, &nom_tex);
		glBindTexture(GL_TEXTURE_2D, nom_tex);
		glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
		glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
		glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
		glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
		glTexImage2D(GL_TEXTURE_2D,0,GL_RGB,TAILLE_JPG,TAILLE_JPG,0,GL_RGB,GL_UNSIGNED_BYTE,d->texture);
		glColor4f(1.0,0.0,1.0,1.0);
 
		glTranslatef(0.5,0.15+translation,0.0);
		glRotatef(180,0.0, 1.0, 0.0);
		glRotatef(sens*d->spin+90,0.0, 0.0, 1.0);
		glScaled(1.0,sens,1.0);
		glScaled(scale,scale,scale);
		glScaled(scale*3,scale*3,scale*3);
 
		glBegin(GL_POLYGON); 
			glNormal3f(1.0,0.0,0.0);
			glTexCoord2f(0.0,1.0);   glVertex3f( 0.5, 0.5, 0.0);
			glTexCoord2f(0.0,0.0);   glVertex3f( 0.5,-0.5, 0.0);
			glTexCoord2f(1.0,0.0);   glVertex3f( -0.5,-0.5,-0.0);
			glTexCoord2f(1.0,1.0);   glVertex3f( -0.5, 0.5,-0.0);
		glEnd();
	glPopMatrix();
	glDeleteTextures(1,&nom_tex);
en gros, j'ai 1 sphère et deux plans.

Je plaque une texture sur eux mais elle est à "l'envers". Pour le moment je me satisfaisait d'un glRotate(180...) mais je voudrais maintenant utilisé la camèra d'openGL.

J'ai essayé d'ajouter :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
	gluLookAt(0.0,4.0,30, 0.0,0.0,0.0, 1.0,0.0,0.0 );
en changeant les paramètres mais je ne trouve pas ma scène quelquesoit la direction.