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

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

Originally posted by anthony:
[b]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[/b]

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

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).

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).