Salut,
Par exemple je fais un cylindre en openGL avec glu comment je fais pour appliquer une texture dessus ?
merci d'avanceCode:
1
2
3
4 glTranslatef(0,25,150); glRotatef(90,1,0,0); gluCylinder(Quadric1,20,20,30,10,10);
Version imprimable
Salut,
Par exemple je fais un cylindre en openGL avec glu comment je fais pour appliquer une texture dessus ?
merci d'avanceCode:
1
2
3
4 glTranslatef(0,25,150); glRotatef(90,1,0,0); gluCylinder(Quadric1,20,20,30,10,10);
tu peux utiliser la generation automatique de coordonnées de textures
exemple
d autre type que sphere mappingCode:
1
2
3
4
5 glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP ); glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP ); glEnable(GL_TEXTURE_GEN_S); glEnable(GL_TEXTURE_GEN_T);
Code:
1
2
3
4 #define GL_EYE_LINEAR 0x2400 #define GL_OBJECT_LINEAR 0x2401 #define GL_SPHERE_MAP 0x2402