View Full Version : Translating and rotating an object

10-17-2005, 04:39 PM
I have a program that loads and displays an object file. It is then supposed to be able to be moved around the screen by the user and rotated arounds its center by the user.

I am keeping track of the rotation and translation data for the object in a struct.

Here is how i am trying to implement this:

glTranslate(translation data)
glTranslate(-translation data)
when i do this, the translations work fine, but the object doesn't rotate in place like it should. Any suggestions?

10-18-2005, 10:49 PM
Could you please post the actual code you are trying to use, that would make it much easier to help you.

I am not sure why you have the last translate call, if are trying to restore the matrix it will not work because you have also done a rotation, put a glPushMatrix() before and glPopMatrix() after instead if you want to preserve the modelview matrix.