I had read a lot of discussions and articles about gluLookAt and how it works etc. However, I am having trouble replicating it with my project.
I will have to use glLoadMatrix to load the 16 values of the object. However, I realized that the object tends to “move” (translate) with the use of gluLookAt.
Please see the below example:
{ 0.540302 0 0.841471 0
0 1 0 0
-0.841471 0 0.540302 -10
0 0 0 1 }
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
glLoadMatrixd([matrix_above]);
gluLookAt(0 ,0,10,
0,0,0,
0,1, 0);
glutWireTeapot(1);
The teapot will be displayed as the following (left), (right) was supposed to be how the teapot is (in the middle of display but rotate on the y-axis).
I tried looking around for a couple of days now but can’t find a better reason on why this is happening. I had tried it with glRotate and glTranslate and gluLookAt works fine. It seems to work weirdly when pairing with glLoadMatrix? Or am I wrong?