Hi,
I am trying to reset the camera back to its original position after performing series of transformations and rotations.
but i cant.
i did all the bounded box calculations then the eye cordinates and center cordinates of object.
am able to projct the object at the center of the screen.
to apply series of transformations , i read somewhere is
save the initial modelview matrix in some matrix.
Identity matrix
multiply by translation
multiply by rotation
…
…
am missing something actually a lot , the transformations change the axes of the object so each time we have to recalculate.
glLoadIdentity();
glTranslatef(-eye.x,-eye.y,-eye.z);
glPushMatrix();
glRotatef(x_ang,1.0,0.0,0.0);
glPushMatrix();
glRotatef(y_ang,0.0,1.0,0.0);
glPushMatrix();
glRotatef(z_ang,0.0,0.0,1.0);
glPushMatrix();
glTranslatef(x,y,z);
*/
drawModel();
/*
glPopMatrix();
glPopMatrix();
glPopMatrix();
glPopMatrix();
i tried something like above but it hasnt worked.
Can any body provide a clue or a hint or an explanation on rotations and tranformations.
i tried gluLookAt but results wer way different than expected.
Kindly revert.
Regards,
Ameya