PDA

View Full Version : viewpoint and rotation point



vbovio
04-13-2007, 09:47 AM
Hi,

I'm writing an app where you have a camera viewpoint and a rotation point (used to spin a model around it), by default, the camera viewpoint and the rotation point are the same (center of the model), but when I change the rotation point, it seems that the viewpoint would have changed although it didn't, see these images:

here (http://img255.imageshack.us/my.php?image=picture1og4.png) both points are the same (center of cube).

and here (http://img156.imageshack.us/my.php?image=picture2gs4.png) is when the rotation point is changed to the lower-left-back vertex (where the coord system is), the model is not centered anymore.

and this is the code where I setup the modelview matrix:



glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslated(0.0, 0.0, -_eyeVectorDistance);
glTranslated(-viewpoint.x, -viewpoint.y, -viewpoint.z);
glTranslated(rotationPoint.x, rotationPoint.y, rotationPoint.z);
glMultMatrixd((double *)&_rotationMatrix);
glTranslated(-rotationPoint.x, -rotationPoint.y, -rotationPoint.z);Thanks in advance.