# The logic of the order in using glTranslate and glRotate ?

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.

Ahemm…
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
glRotatef(angle,0.0,1.0,0.0);
glTranslatef(0.0,0.0,-5.0);
// I rotate and then translate 5 units backwards, always facing the origin

Example 2: a point orbits around you
glTranslatef(0.0,0.0,-5.0);
glRotatef(angle,0.0,1.0,0.0);
// 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!)
tFz

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