• Advertisement
Sign in to follow this  

rotation problem??

This topic is 4254 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys! I developed a mesh class with rotateX() , rotateY(),rotateZ() methods! In what is the order of rotation in glRotatef(angle,x,y,z) ? first X,Y then Z??? thanks

Share this post


Link to post
Share on other sites
Advertisement
OpenGL's glRotatef(angle,x,y,z) rotates around an axis given as [x,y,z], and the angle specifies just the angle.

So, if you want to rotate e.g. around Y,X,Z axes then you have to invoke glRotatef 3 times, like so
glRotatef(gamma,0,0,1); // rotate by gamma around Z
glRotatef(beta,1,0,0); // rotate by beta around X
glRotatef(alpha,0,1,0); // rotate by alpha around Y

But notice that the actual axis you may want to rotate around may change with the co-ordinate system working in. E.g. it makes a difference whether you rotate around the global axes or local axes.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement