when I rotate around X, the object does not rotate on its Axis but, rotates on Global Axis… I think that if I would put glRotated() inside the Push/Pop Matrix, the object would rotate with respect to its own axis, am I right ???
[This message has been edited by jubei_GL (edited 05-01-2002).]
If you want only the object to rotate and not the world, then you have to push, rotate and pop the object. That also includes other objects that you also want to rotate around their axis also, each object will have to be push, rotate and pop!!!
example:
//list of objects to draw
for(x=0; x < 10; x++) //Draw ten objects rotating around their axis.
{
glPushMatrix()
glTranslate(…)// move our object some place on the screen.
glRotate(…)// Rotate around axis
draw_object(x); // Draw object number x
glPopMatrix()
}
Originally posted by Jambolo: The object already will rotate on its own axis. The push and pop prevent other objects from being rotated too.
[This message has been edited by nexusone (edited 05-03-2002).]
Originally posted by velco: …glTranslate first, glRotate second.
Yes, like this.
Translating first/rotating second will translate in the current system, then rotate in the new (translated) system. Rotating first/translating second will rotate in the current system, then translate in the new (rotated) system. Scale works the same way. If you understand this, then you understand how the order of transformations works in OpenGL.