PDA

View Full Version : pivot point



12-17-2004, 11:23 AM
I've some problems with rotation..when I load an obj object in my opengl api application, the object changes its pivot point due to unitize function,I guess. So when I rotate it, it moves by a global rotation and loses its original pivot point. How can i do? thanks!

Overmind
12-18-2004, 05:12 AM
First translate the pivot point to the origin, then rotate and translate the pivot point back to where it should be.

If your Pivot point is (x,y,z), you do the following:

glTranslatef(x, y, z);
glRotatef(...);
glTranslatef(-x, -y, -z);