jleffelm
03-10-2003, 06:55 AM
I had a quick question that I was hoping someone could help shed some light on. I recently found out how to use glMatrixMode( GL_TEXTURE ) to rotate a texture. From what I had been reading, it sounds like I should be able to produce a translation of the texture also, but I can't seem to get that to work(or it is working, and I am expecting something else to happen).
What I have right now, is a plane, with a texture on it, and when I do:
glMatrixMode( GL_TEXTURE );
glRotatef( angle, 0.0, 0.0, 1.0 );
glMatrixMode( GL_MODELVIEW );
DrawPlane();
I get the texture to rotate, and it appears to be rotating around the (s,t)(0,0) corner of the texture(at least that is what I think I am seeing). Then I figured I would try adding a glTranslatef( x, y, z ) when GL_TEXTURE is set, and nothing happens. I was going to try and figure out a way to rotate the texture around the center point of the plane that I was creating. Can anyone explain how to do this, and possibly what glTranslate() does to the texture when called when GL_TEXTURE is set. Thanx.
-Drew
What I have right now, is a plane, with a texture on it, and when I do:
glMatrixMode( GL_TEXTURE );
glRotatef( angle, 0.0, 0.0, 1.0 );
glMatrixMode( GL_MODELVIEW );
DrawPlane();
I get the texture to rotate, and it appears to be rotating around the (s,t)(0,0) corner of the texture(at least that is what I think I am seeing). Then I figured I would try adding a glTranslatef( x, y, z ) when GL_TEXTURE is set, and nothing happens. I was going to try and figure out a way to rotate the texture around the center point of the plane that I was creating. Can anyone explain how to do this, and possibly what glTranslate() does to the texture when called when GL_TEXTURE is set. Thanx.
-Drew