I must apologize in advance. I am fairly new to OpenGL. I know this question has been asked before . I can get my scene to draw however it seems that I am missing something. After inverting the matrix the scene seems to translate and rotate correctly but while rotating the camera its as if there is some kind of "reverse parallax" effect where elements farther away move faster than elements in the foreground. In any case, I am hoping there is someone here who has gone through this before and could share their process with me. Here is my code:
suites.LayerSuite()->AEGP_GetLayerToWorldXformFromView(camera_layer, &comp_timeT, &comp_timeT, &matrix));
gluPerspective((atan((height/2.0)/focalLength)*2.0/PF_RAD_PER_DEGREE), width/height, 0.1, 1000);
GLfloat matrixInverted[16];
GLfloat cameraMatrix[16];
for(int i = 0; i < 4; i++)
for(int j = 0; j < 4; j++)
cameraMatrix[i*4+j] = matrix.mat[i][j];
invertMatrix((float*)cameraMatrix, (float*)matrixInverted);
glLoadMatrixf((GLfloat*)invertedMatrix);
drawScene();
Thanks in advance!
SU