Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: glRotateF about the Z-axis

  1. #1
    Intern Contributor
    Join Date
    Jan 2005
    Location
    Lexington, KY
    Posts
    50

    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?

  2. #2
    Junior Member Newbie
    Join Date
    Apr 2005
    Posts
    9

    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
  •