Jump to content
  • Advertisement
Sign in to follow this  
hphuc

Rotation in Lesson 6???

This topic is 5084 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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!