PDA

View Full Version : problem with texture



Batka
09-09-2005, 10:44 AM
Haw can I put texture on gluCylinder. I want to put some small texture on one Cylinder.
void studnia(){

//studnia

glTranslatef(10,0,10);

GLUquadricObj* studnia; // pow. wody
glEnable(GL_TEXTURE_2D);

glBindTexture(GL_TEXTURE_2D, texture[1]);
glColor3f(1.0f,1.0f,1.0f);
glRotatef(-90,1,0,0);

studnia = gluNewQuadric();
gluQuadricTexture(studnia, GL_TRUE);
gluCylinder(studnia,4.0, 4.0, 3, 15, 15);

glRotatef(90,1,0,0);

Orzech
09-11-2005, 12:47 PM
I guess that you should allow GLU to calculate normals for you :

gluQuadricNormals(quadratic, GLU_SMOOTH);

Anyway, you shouldn't put this :

studnia = gluNewQuadric();inside the main loop. The quadric object needs to be created only once. You might want to declare 'studnia' as a global variable.

Pozdrawiam ;)

Orzech
09-12-2005, 08:00 AM
When I was brushing my teeth in the morning and I was thinking what I have done yesterday, I realized that smooth normals don't have much to do with texture binding. Anyway, it's worth a try. ;)