PDA

View Full Version : glRotateF about the Z-axis



bubbaJr
04-22-2005, 04:32 AM
I've got a 640x480 window that has symbols drawn on it (circles, crosshairs, etc.). All of the symbols are centered around 320, 280. I've been using glRotatef like this:

glPushMatrix();
glRotatef( angle, 0.0, 0.0, 1.0 );

-draw all the symbols

glPopMatrix();
glFlush();

It's definitely doing a rotation about the z-axis, but it's rotating everything around the lower left corner of the window.

How do I get everything to rotate around 320,280?

Topquark
04-22-2005, 11:16 AM
glTranslatef(320, 280, 0);
glRotatef(...);
glTranslatef(-320, -280, 0);
//draw objects

Remember, transformations will be applied from bottom to top.