View Full Version : About texture matrix
09-05-2002, 04:53 AM
Actually what the is the function of texture matrix? I know projection and modelview matrix, but texture matrix...
Any example of it?
09-05-2002, 05:37 AM
It is used to modify texture coordinates.
09-05-2002, 05:39 AM
Try this in your main loop:
static float Angle = 0.0;
glMatrixMode ( GL_TEXTURE );
glRotatef ( Angle++, 0.0f, 1.0f, 0.0f );
glMatrixMode ( GL_MODELVIEW );
....now you can see what texture matrices are for http://www.opengl.org/discussion_boards/ubb/wink.gif (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.).
09-05-2002, 07:16 AM
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?
09-05-2002, 07:55 AM
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 http://www.opengl.org/discussion_boards/ubb/wink.gif
09-05-2002, 11:02 AM
How about using it with glTexGen?
09-05-2002, 11:47 AM
Yes, for projective texturing - but for the simple example of demonstrating what it *does* - I think we'll start with simple rotation http://www.opengl.org/discussion_boards/ubb/wink.gif
09-05-2002, 12:06 PM
That was it Robbo, thanks... once I set it to REPEAT it restarts the cycle just before it turns into the group of lines ;-)
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.