PDA

View Full Version : Rotation



07-18-2005, 03:26 PM
How do u calculate the coordinates of a vertex after a rotation. I have the angle and the vector but i cant call glRotatef()

avocados
07-18-2005, 06:16 PM
You probably want to use some matrix operations, though I don't think you can do that if you want to do this between glBegin() and glEnd(). You can also do the rotations yourself.

Rotate your vertex by the negative orientation of the rotation vector(so that, say, the rotation vector would be pointing down the z axis, canceling it out). Then rotate the x, y coordinates by the number of degrees you used in the glRotate call. Then rotate by the orientation of the rotation vector and you will have your final point.