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 4 of 4

Thread: rotating........

  1. #1

    rotating........

    ok i'm very new to OpenGL just got everything working /linking/ and stuff which took me two days to get! now i juade made this human with spheres and cubes, it looks pretty cool but the think is i want to be able to rotate the guy and see is back and is side........i know about the glRotatef function but not quite sure how to use it....can someone shed a little light on this please.....thank you

  2. #2
    Junior Member Regular Contributor
    Join Date
    Dec 2000
    Location
    montreal
    Posts
    227

    Re: rotating........

    You call glRotate just before rendering your object and you do that to the modelview matrix.
    If you're new, post to the beginners group. Besides, there are tons of demoes out there such as at the ati and nvidia site.

    V-man
    V--man

  3. #3
    Junior Member Regular Contributor
    Join Date
    Dec 2000
    Location
    montreal
    Posts
    227

    Re: rotating........

    woops, this is the beginners forum!
    V--man

  4. #4
    Member Regular Contributor
    Join Date
    Jul 2001
    Posts
    409

    Re: rotating........

    glRotatef makes a rotation around an axis. You have to specify the angle of rotation, together with the (x,y,z)-coordinates of a vector lying on this axis. The call looks like :
    glRotatef (angle_in_degrees, axis_x, axis_y, axis_z);
    for example, you could write glRotatef (180, 0, 1, 0); if you want to make an half turn around the y-axis.

    P.S.: you have to call glRotatef BEFORE drawing your model. Your display function should look like

    glClear(...);
    glLoadIdentity (); //cancels old calls to glRotatef
    glRotatef(...);
    DrawMyModel ();
    glutSwapBuffers (); //if you're using glut
    I hope that this will help.

    [This message has been edited by Morglum (edited 07-26-2001).]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •