Rotate camera around point-of-interest in opengl
I want to rotate my "camera" around a point of interest. Currently the camera only rotates around the origin.
The standard way:
Unfortunately, this doesn't work. My application uses a translation vector (QVector3D) as well as a quaternion (QQuaternion) to save translation and rotation of the camera.
Currently, it is done like this, which always rotates around the origin:
where mulMatrix uses the Quaternion to build a 4x4 matrix which is passed to glMultMatrixf();
Using something like this:
results in very weird controls which I'm unable to describe further. In my application translation.z() means: move the camera forward. Changing x() and y() issues a pan like operation.
Help is greatly appreciated. :)