Sign in to follow this  

Simple Rotation Problem :/

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

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

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