About texture matrix

Actually what the is the function of texture matrix? I know projection and modelview matrix, but texture matrix…
Any example of it?

It is used to modify texture coordinates.

Try this in your main loop:

static float Angle = 0.0;

glMatrixMode ( GL_TEXTURE );
glLoadIdentity ();
glRotatef ( Angle++, 0.0f, 1.0f, 0.0f );
glMatrixMode ( GL_MODELVIEW );

…now you can see what texture matrices are for (should spin the texture around on the primitive its drawn on).

More advanced uses of texture matrix involve projective textures (calculates texture coords on the fly, according to light positions etc.).

ooh, cool effect… But I have a question on that texture rotation… why would pattern lines on the texture rotate to the point that they end up as straight lines across say the side of a cube for a few seconds before restarting the cycle again. Is there something that you can use to stop this from happening?


I think I know what you mean - but it depends on whether you have specific your texture as REPEAT or CLAMP. I am assume you are clamping

How about using it with glTexGen?

Yes, for projective texturing - but for the simple example of demonstrating what it does - I think we’ll start with simple rotation

That was it Robbo, thanks… once I set it to REPEAT it restarts the cycle just before it turns into the group of lines :wink: