Public Group

# rotation problem??

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

## 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 on other sites
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.

1. 1
Rutin
32
2. 2
3. 3
4. 4
5. 5

• 13
• 9
• 9
• 9
• 14
• ### Forum Statistics

• Total Topics
633323
• Total Posts
3011361
• ### Who's Online (See full list)

There are no registered users currently online

×