PDA

View Full Version : glTranslate - glRotate



12-05-2002, 08:30 AM
On which matrix does process glTranslate and glRotate ?
The one choose by glMatrixMode or always GL_MODELVIEW ?

zhhui
12-05-2002, 09:35 AM
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(dx,dy,dz);
or
glRotatef(angel,dx,dy,dz);


Originally posted by Matthieu DUFOURNEAUD:
On which matrix does process glTranslate and glRotate ?
The one choose by glMatrixMode or always GL_MODELVIEW ?

yakuza
12-05-2002, 09:47 AM
glTranslate* and glRotate* will affect whatever matrix is the currently active matrix.

For example:



glMatrixMode(GL_TEXTURE);
glRotatef(angle, 0.0f, 1.0f, 0.0f);


The above code would rotate the texture on your object. Of course, you'd probably want to glPushMatrix() and glPopMatrix() around the changes to the texture matrix, and restore the modelview matrix after you were done.

Hope that helps.