Advertisement

Rotating a texture

Started by April 11, 2002 11:25 AM
2 comments, last by Bruno 22 years, 10 months ago
Hi This should be rather simple, but i can''t get it to work. Supose i have a quad, and i want the texture wich is binded to that quad to rotate, but the rotation should be done on the center of the quad. What i''m doing is the following : glMatrixMode(GL_TEXTURE); glTranslatef(0,0,0.5f); glRotatef(angle,0,0,1.0f); glTranslatef(0,0,-0.5f); glMatrixMode(GL_MODELVIEW); thanks, Bruno
Why are you translating in the z direction?
Advertisement
I''m not..
That was made in a moment of desesperation, and i pasted the wrong code., i''m translating in x/y to match u/v

try:

gltranslate(-.5,-.5,0); // translate to middle of texture
glrotate(angle,0,0,1); // rotate
gltranslate(.5,.5,0); // translate back

You may have to swap the signs of the translates, nor sure. The point is translate to the middle of the texture, and rotate there. Havent tried it, let me know.

zin

zintel.com - 3d graphics & more or less
zintel.com - 3d graphics & more or less

This topic is closed to new replies.

Advertisement