Results 1 to 3 of 3

Thread: Rotation

  1. #1
    Junior Member Newbie
    Join Date
    Jan 2004
    Posts
    11

    Rotation

    I am trying to rotate a billboard (with a bitmap loaded onto it).

    Tfe billboard is drawn at the origin facing up the z- axis. The drawing is translated into the correct position on screen and then glRotate() function rotates it round to the correct orientation, so that it faces the correct direction, (The direction so that it can be seen by the user)

    However, once this is accomplished I need to be able to rotate it, in it's own axis, so that it seems to be stationary just rotating about its centre.

    I have tried to rotate it at the origin before drawing it, and i have also tried to rotate it about the vector orthognal to it, facing the user position. Both attemps, see the billboards completely dissapearing.
    please help
    thanks
    Anthony

    e-mail anthony.moss@baesystems.com

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Jun 2000
    Location
    Gastonia, NC, USA
    Posts
    2,068

    Re: Rotation

    Can you post the part of the code where you translate/rotate the object?

    Originally posted by anthony:
    I am trying to rotate a billboard (with a bitmap loaded onto it).

    Tfe billboard is drawn at the origin facing up the z- axis. The drawing is translated into the correct position on screen and then glRotate() function rotates it round to the correct orientation, so that it faces the correct direction, (The direction so that it can be seen by the user)

    However, once this is accomplished I need to be able to rotate it, in it's own axis, so that it seems to be stationary just rotating about its centre.

    I have tried to rotate it at the origin before drawing it, and i have also tried to rotate it about the vector orthognal to it, facing the user position. Both attemps, see the billboards completely dissapearing.
    please help
    thanks
    Anthony

    e-mail anthony.moss@baesystems.com


    [This message has been edited by nexusone (edited 05-10-2002).]

  3. #3
    Senior Member Regular Contributor
    Join Date
    Jan 2002
    Location
    Kingston, Jamaica, W.I.
    Posts
    282

    Re: Rotation

    You need to rotate the object on its own axis, then translate it and finally rotate the translated position to get it in the right direction. However to achieve this you have to specify the transforms in reverse order (hence the following code).
    Code :
    glRotate(Dir, ...)                   // Rotate to position in correct direction.
    glTranslate(...)                     // Translate to position at correct distance.
    glRotate(RotAmount, ....)     // Rotate around own axis.
    DrawBillBoard()                   // Draw billboard.
    Also remember the two rotations will be cumulative and cause your billboard to turn more on it's axis than bargained for. You'll have to compensate for that (something like RotAmount -= Dir; if they rotate around the same axis).

Similar Threads

  1. Rotation of an object by rotation matrix
    By MrFoil in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 03-02-2015, 04:41 PM
  2. Matrix Rotation loses 1 axes of rotation
    By Benzino in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 02-15-2011, 06:53 AM
  3. Replies: 1
    Last Post: 04-16-2010, 02:59 PM
  4. changing axis of rotation and center of rotation in openGL performer
    By ravishashi in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 07-08-2003, 04:42 AM
  5. world rotation v. body rotation
    By cosmicGirl in forum OpenGL: Basic Coding
    Replies: 31
    Last Post: 03-11-2003, 12:10 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean