PDA

View Full Version : texture transform



06-24-2003, 05:33 PM
I am displaying a polygon that I generate texture coordinates for. I also loaded a texture and set the texture coordinates on that. Currently I get a one-one mapping of my texture to my poly and it displays - hurrah.

I would like to rotate the texture on the poly without regenerating the poly or reloading the texture. I use the texture for multiple polys and I want a different stretch/orientation on each poly.

Can someone point me in the right direction please.

thanks

06-24-2003, 06:39 PM
OpenGL has a texture stack that can be used.

dorbie
06-24-2003, 08:12 PM
Use glMatrixMode to select the texture matrix, once in this mode transformation calls are applied to the texture matrix.

06-25-2003, 08:45 AM
Ah the texture matrix - duh, that's great!

thanks

06-25-2003, 08:54 AM
A related question...

Are the underlying u,v texture coordinates for a texture always defined as 0 <= uv <= 1?

I realize that with my new knowledge of the existence of the texture matrix I can simulate other texture coordinate systems but it seems like being able to specify the range of u,v on the original texture might be handy.

For instance in my case all my geometry is generated at -1 <= xyz <= 1. My textures space always seem to be 0 <= uv <= 1. The result is I always get 4 copies of my texture on my geometry unless I specify the texture transform.

I would therefore prefer that my textures are in the same -1 <= uv <= 1 so that if my texture matrix is identity I would get a 1:1 mapping to my geometry.

If this can't be done it's no big deal - I'll just use the matrix transform.

thanks