View Full Version : The logic of the order in using glTranslate and glRotate ?

05-14-2001, 11:57 PM
How should I think when I'm using glTranslate and glRotate to acomplish what I want:
- rotate by the axe of the object
- rotate by the axe of the space
- rotate by the axe of the object in other point that the center of the space.

I have succeded to realize those things but I didn't catch the logic OpenGL uses.

05-15-2001, 12:19 AM
I think in this way (don't know if it's right, however...)
*When an object is drawn, it is affected only by the previous gltranslate glrotate.
*I assume the object is drawn in the origin, and I'm moving
- rotate by the axe of the object
>>> glrotate with angle alpha
- rotate by the axe of the space
>>> glrotate with angle -alpha

Example 1: you orbit around a point
// I rotate and then translate 5 units backwards, always facing the origin

Example 2: a point orbits around you
// I translate backwards 5 units (this means that every time I'm in the same point) and then I rotate on myself... or the point rotates around me!

Hope this helps (and hope this is right!)

[This message has been edited by Teofuzz (edited 05-15-2001).]

05-15-2001, 01:23 AM
I was in a discussion about this the other day: http://www.opengl.org/discussion_boards/ubb/Forum2/HTML/003759.html

Hope that helps.