I have to change a camera implementation built with gluLookat
and glMultmatrixf
.
The camera implemented is an arcball camera where the camera rotates around a point.
Orientation of the camera is by
//set projection
glMatrixMode(GL_PROJECTION);
gluPerspective (..);
//modelview
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(pCamera.x, pCamera.y, pCamera.z,
pTarget.x, pTarget.y, pTarget.z,
up.x, up.y, up.z);
And is followed by
glMultMatrixf(transformViewMatrix);
to move the camera around the point, where transformViewMatrix
is calculated from mouse coord
I have to integrate Oculus Rift with the camera so the camera can rotate on spot instead of around a point.
I can get a rotation matrix from Oculus sensor, rotOculus
.
I tried multiplying transforViewMatrix
with rotOculus
.
glMultMatrixf(transformViewMatrix*rotOculus);
but get that the object I am looking at is rotating on spot instead of the camera
then I tried to assign transformViewMatrix
with rotOculus
, but that is same as arcball rotation with mouse, just changed to Oculus.
I think in order to rotate camera on spot, I need to translate the camera to origin by pCamera
, then glMultMatrixf(rotOculus)
?
But I dont have access to how I can order glTranslate
, gluLookAt
, glMultMatrixf
methods because those are implemented in a dll, I can only change pCamera
, pTarget
, up
, and viewTransformMatrix
.
Could anyone point how I could rotate camera on spot in this situation? Thank you.