Hi Theo,

I just have a small little question: when you multiply your screen coordinates 
by the inverse matrix you are using the z values of 0.0 and 1.0 for the points 
on the near and far planes, right? Are you using these values because they were 
previously set on your projection matrix or for some other reason?

It's because that matrix maps a cube going from (0,0,0) to (1,1,1) into world space. So in that cube, z=0 is the nearest z you can have, and z=1 is the furthest z you can have.

Which reminds me, the x and y coordinates I put in the calculations I sent you must be normalized coordinates, i.e.

float normalized_x = (float)screen_x / (float)viewport_width;
float normalized_y = (float)screen_y / (float)viewport_height;

So say you have screen_x = 320, screen_y = 240 and your viewport is 640x480, normalized_x = 0.5 and normalized_y = 0.5. Those are what you use in the calculations I sent you before.

Hope this helps,

J-S
--
______________________________________________________
Jean-Sebastien Guay    [email protected]
                               http://www.cm-labs.com/
                        http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to