Probleme pour texturer une sphere

Résolu
mikey84 Messages postés 14 Date d'inscription samedi 1 janvier 2005 Statut Membre Dernière intervention 14 février 2005 - 30 janv. 2005 à 02:10
Arnaud16022 Messages postés 1329 Date d'inscription vendredi 15 août 2003 Statut Membre Dernière intervention 16 juin 2010 - 2 févr. 2005 à 17:53
Bonjour! j'ai un énorme problème. J'ai essayé d'appliquer une texture sur ma sphère avec la librairie devil, avec opengl et glut et aucun n'a fonctionné. Le pire c'est que meme avec les tutos je comprend pas pourquoi ca marche pas je fais tout pareil pourtant! Au lieu que la texture s'affiche la sphère prend une couleur unie!
ca c'est mon code :

GLUquadricObj *Quadric1 = gluNewQuadric();
chargeSphere();
glPushMatrix();
glEnable(GL_TEXTURE_2D);
glTranslated(0,0,-15);
glRotatef (rx,1.0,0.0,0.0);
glRotatef (ry,0.0,1.0,0.0);
glRotatef (rz,0.0,0.0,1.0);
glBindTexture (GL_TEXTURE_2D, texID);
gluSphere(Quadric1, 5,25, 25); )
gluQuadricTexture(Quadric1, GL_TRUE);
glPopMatrix();

et ca c'est ma fonction qui charge une texture :

void chargeSphere()
{
AUX_RGBImageRec *texture1;
texture1 = auxDIBImageLoad("texture.bmp");
glGenTextures (1, &texID);
glBindTexture (GL_TEXTURE_2D, texID);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, 3, texture1->sizeX, texture1->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, texture1->data);
};

est ce que quelq'un voit ce qui ne va pas? merci d'avance

3 réponses

Arnaud16022 Messages postés 1329 Date d'inscription vendredi 15 août 2003 Statut Membre Dernière intervention 16 juin 2010 2
30 janv. 2005 à 22:04
gluQuadricTexture(Quadric1, GL_TRUE);
devrait etre avant glSphere
Si tu n'es pas sur de ta fonction de chargement d'image, tu devrais faire un carré texture, comme ca tu saurais.

_______________________


Omnia vincit labor improbus
3
mikey84 Messages postés 14 Date d'inscription samedi 1 janvier 2005 Statut Membre Dernière intervention 14 février 2005
30 janv. 2005 à 23:07
Grace a toi la texture s'affiche! je te remercie il fallait effectivement mettre gluQuadricTexture(Quadric1, GL_TRUE); avant la creation de la sphere. Merci pour ton aide j'étais désespéré!
0
Arnaud16022 Messages postés 1329 Date d'inscription vendredi 15 août 2003 Statut Membre Dernière intervention 16 juin 2010 2
2 févr. 2005 à 17:53
pas de quoi
en fait j'étais meme pas sur que ca change quoi que ce soit

_______________________


Omnia vincit labor improbus
0
Rejoignez-nous