-
glRotateF about the Z-axis
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?
-
Re: glRotateF about the Z-axis
glTranslatef(320, 280, 0);
glRotatef(...);
glTranslatef(-320, -280, 0);
//draw objects
Remember, transformations will be applied from bottom to top.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules