Jump to content
  • Advertisement
Sign in to follow this  
MyCatIsTheBest

Simple Rotation Problem :/

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

Advertisement
More specifically you need to translate to the center of the object.

glTranslate(obj.width/2, obj.height/2, obj.depth/2)
glRotatef(roty, 0, 1, 0);
glColor3f(0, 0, 1);
glCallList(dList);
glPopMatrix();

Share this post


Link to post
Share on other sites
From your code
Quad[4][3][2] = 0 + loc[2] + width;

Completely off topic but why is there a 0 here. I am just curious if there is a reason for this I am not aware of.

not 100% but try this

trans(-loc[0], -loc[1], -loc[2])
rot
trans(loc[0], loc[1], loc[2])

or LoadIndentiy after push matrix

Share this post


Link to post
Share on other sites
or try this
glTranslate*(objx,objy,objz);
glPushMatrix();
glLoadIdentity();
glRotate*();
drawobj();
glPopMatrix();

Share this post


Link to post
Share on other sites
theres 2 things that i know of that cause this.

1. the objects in your matrix arent centered.

or

2. you perform a rotation before translation.


the former would look more "orbity" though.

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!