# Rotation in Lesson 6???

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

## Recommended Posts

I don't understand these lines in Lesson 6: glRotatef(xrot,1.0f,0.0f,0.0f); glRotatef(yrot,0.0f,1.0f,0.0f); glRotatef(zrot,0.0f,0.0f,1.0f); I understand each line but when putting them as above, I don't know how the object rotates.

##### Share on other sites
Quote:
 Original post by hphucglRotatef(xrot,1.0f,0.0f,0.0f);glRotatef(yrot,0.0f,1.0f,0.0f);glRotatef(zrot,0.0f,0.0f,1.0f);

The xrot, yrot, and zrot each individually control the speed at which your item rotates about each axis. As far as knowing which way they will rotate. Shut down each rotate function and only use one at a time until you can get a feel for which way they will turn.

Hope this helps...

##### Share on other sites
Can you tell more ? I still don't understand which way they rotate.

##### Share on other sites
I'll start by posting the function's declaration:
glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)

Angle is in degrees. The parameters x, y, and z specify the vector about which the rotation is to take place. (Er, not the best description).

Thus, a call to glRotatef(45.0f, 0.0f, 1.0f, 0.0f) would rotate the object 45 degrees about the y axis.

1. 1
2. 2
3. 3
Rutin
23
4. 4
5. 5

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

• Total Topics
632932
• Total Posts
3009296
• ### Who's Online (See full list)

There are no registered users currently online

×