PDA

View Full Version : camera position from modelview matrix



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

thanks,
lobbel

dletozeun
07-28-2009, 05: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.

lobbel
07-28-2009, 08: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.

lobbel

dletozeun
07-28-2009, 09: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.