A quickie for the maths types in here:

Having got the current viewing frustum by multiplying the projection matrix by the camera’s modelview matrix, I’d like to know the world coordinates of the eight points of the box.

I assume if I feed in the screen coordinates (0,0,near) (640,0,near) (0,480,near) (640,640,near) (0,0,far) (640,0,far) (0,480,far) (640,640,far) into the inverse of this matrix I’ll get the world coordinates of my view frustum?

TIA if anyone can confirm this for me.

Cas

Hello,

yes, that’s right, but you will need to convert your device coordinates into retinal coordinates.

The opengl projection matrix maps 3D points to points bounded by +/-1. ie. x=-1 corresponds to the left edge of the screen and x=1 to the right edge of the screen (and y=-1 to the bottom of the screen and y=+1 to the top). the glViewport is then applied to get pixel coordinates (ie. mapping -/+1 to 0,639, or whatever you have).

gluUnproject will do this all for you, tho’.

cheers

John

gluUnproject()?

Why, so it will!

Doh.

Thanks.

Cas