View Full Version : Texture mapping problem

05-29-2011, 12:00 AM
I've just encountered a problem in mapping texture.
I use glutSolidTorus to draw a solid torus. I successfully mapping texture to the torus. However, when I rotate it about x,y,z axis, it seems that the texture doesn't move with the torus.
My code is as follows:

gluQuadricTexture(quadric, true);
glBindTexture(GL_TEXTURE_2D, text);
glutSolidTorus(r * 0.25, r, 61, 37);

How can I fix this problem?

Alfonse Reinheart
05-29-2011, 12:18 AM
Of course it doesn't; you turned on texture coordinate generation. This computes texture coordinates based on the positions of the triangles. Rotating the object changes the positions, and therefore it changes the texture coordinates. You want texture coordinates that are fixed, and therefore don't change under object rotation.

You will have to provide texture coordinates rather than generating them.