Texture Matrix

Hello!
I have one simple question. It is… What happens when rotating a texture matrix? It changes texture coordinates, or what? It would be great if someone could answer my question or explain me where am I wrong (if rotating texture matrix is not possible).

Thanks!

If you are looking to rotate a texture with an object, you do not need to touch texture matrix. From what I have read, the texture matrix allows you to add effects to textures which would otherwise be unattainable or difficult at best. Never messed with it as yet.

For having preexisting texture rotate with object rotation you just need to rotate about global center, translate, rotate about self, enable texturing, bind an existing texture, call glTexEnv to set up aspects of how you want the texture handles, draw polygons with tex coords, and disable texturing otherwise it will texture next object.

example

glRotatef(angle1, 0.01, 1.0, 0.0);
glTranslatef(250.0, 0.0, 0.0);
glRotatef(angle2*5, 0.03, 1.0, 0.0);
glEnable(GL_TEXTURE_2D);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glBindTexture(GL_TEXTURE_2D, texName[0]);
// gluQuadricTexture(quadsphere, GL_TRUE);
glSphere(2.0, 15, 15, TRUE, TRUE);//custom - used to be gluSphere
// gluQuadricTexture(quadsphere, GL_FALSE);
glDisable(GL_TEXTURE_2D);

If you are looking to do some effects with the texture matrix, sorry for the confusion.

[This message has been edited by shinpaughp (edited 03-08-2003).]

Hi.
Well I was thinking about something else. I know how to texture objects. I just wanted to know if there’s any sens in rotating, scaling or translating texture matrix. You said that it can be used for making some addidtional effects. Any idea where can I find some info about it?

Thanks

Texture matrices are very useful when you want to render things such as a moving sky!!
This is how I use it. You can rotate, scale, and translate the texture as if it were a regular model.

Good luck.

Originally posted by mancha:
You can rotate, scale, and translate the texture as if it were a regular model.

Hmm… So it changes texture coordinates, isn’t it? I suppose that I can’t use glMatrixMode() between glBegin/glEnd. Am i right? It would be too nice if that would be possible .

Thanks

That is right. But you want to have the matrix mode change outside of the glBegin, glEnd.

Originally posted by Orzech:
[b] Hmm… So it changes texture coordinates, isn’t it? I suppose that I can’t use glMatrixMode() between glBegin/glEnd. Am i right? It would be too nice if that would be possible .

Thanks

[/b]