View Full Version : camera position from modelview matrix

07-28-2009, 04:16 AM
hello, how can I get the
camera position and viewing direction
from the modelview matrix?


07-28-2009, 04:35 AM
You can't really do it because Modelview matrix is "model" and "view" matrices. So it is modeling transformations at viewing transformations at the same time.

You are only able to get this information right after camera transformation (so right before modeling transformations). Or if you know what is the modeling transformation, apply the inverse matrix but that's really not efficient. You better manage your own matrices and you will get easily what you need.

07-28-2009, 07:23 AM
Ok, so i better build my own camera.
In what space do I operate then ?
I mean if I have my own matrices and vectors
it should be object space until I call
gluLookat and set the values from the
camera class.


07-28-2009, 08:23 AM
The camera transformation is applied after modeling transformation which place each scene object in the world space.
So camera matrix transforms coordinates from world space to eye space.