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 both points are the same (center of cube).
and here 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.