View Full Version : Texture Matrix Rotation

01-01-2007, 04:03 PM
I have a simple square texture which maps to a simple quad.

I want the the mapped quad to rotate as it moves.

Is it faster to
1) rotate the vertices of the quad using the modelview matrix
2) rotate the texture coords using the texture matrix
the same?

Thanks for any feedback

01-01-2007, 06:40 PM
1+2 are gonna give different visual results

both aint super fast
your best bet would be
A/to update the rotated texcoords or verts on the cpu + send them to be drawn
B/do the rotation in the vert shader

01-03-2007, 11:32 AM
I'm hard pressed to imagine why you'd ever want to do anything more than (1) if you don't have to.

01-03-2007, 12:31 PM
i thought that too, but then considered he might be talking about drawing 600,000 of these hypothetical quads - maybe billboarded or something. If so, a modelview matrix change for each quad becomes an issue.

01-04-2007, 03:11 AM
Seems no more expensive than a texture matrix change, no?

01-05-2007, 12:26 AM
no, but a shader (as suggested by zed) would be a better solution, yes?

01-05-2007, 02:27 AM
Yes, but it depends on the hardware, no?

01-05-2007, 11:38 AM
Love these one-liner responses. :)
If you use a shader to simplify, then it doesn't matter much whether you use it to rotate the quad or its texture coords.

01-05-2007, 02:21 PM
Rotating the texture will result in a different look, because the texture might be cut of at the corners, when it is rotated by 45 degrees.

Also the hardware is optimized to work with an identity-matrix as the texture matrix. So it might be slower.

Haven't tried it yet, although i will need to do it soon. Tell me what solution you used and how well it worked.