View Full Version : camera parameters

09-19-2000, 03:33 AM
Hi all,

I'm looking for a way to "extract" the camera parameters from the OpenGL modelview matrix. These parameters are the ones used with gluLookAt like camera position, up vector,...

anyone have any ideas?

09-19-2000, 04:23 AM
You can do like this I think:
Create a look-at vector (called l here) that is pointing from the world origin down the positive z-axis (the default look-at vector). This vector can be of any length, but unit length is a "standard" length. l=(0,0,1,1)
Create the upvector (called u here) that is pointing from the world origin, and upwards along the positive y-axis (the default up-vector). u=(0,1,0,1)

Then multiply these two vectors with the current modelview matrix, and you should have the look-at vector and upvector in world coordinates.

I think you also can multiply the origin o=(0,0,0,1) with the modelview matrix to get the current viewposition.

[This message has been edited by Bob (edited 09-19-2000).]