Sign in to follow this  

Rotation in Lesson 6???

This topic is 4867 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

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 this post


Link to post
Share on other sites
Quote:
Original post by hphuc
glRotatef(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 this post


Link to post
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.

Share this post


Link to post
Share on other sites

This topic is 4867 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this