PDA

View Full Version : gluPickMatrix



devdept
07-20-2007, 02:58 PM
Do you know what matrix calculations happen inside this function?

Is there a detailed explanation somewhere on the web?

Thanks a lot,

Alberto

skynet
07-21-2007, 02:55 AM
The calculation determines, which section of the normalized device coordinates (-1..1 in all axis) maps to the given subsection of the viewport.
This subsection of the NDC is then strechted and translated so it covers the whole -1...1 range.
In effect you "pick" a subsection of the viewport and "zoom" into it.

devdept
07-21-2007, 07:16 AM
Skynet,

I know, but I need to do it manually. I need all the math steps to reproduce it.

Thanks!

Alberto

kon
07-21-2007, 10:29 AM
here is the direct link to the file (last function):
project.c (http://oss.sgi.com/cgi-bin/cvsweb.cgi/projects/ogl-sample/main/gfx/lib/glu/libutil/project.c?rev=1.4;content-type=text%2Fplain)

and this is the opengl sample implementation:
ogl-sample implementation (http://oss.sgi.com/cgi-bin/cvsweb.cgi/projects/ogl-sample/main/gfx/lib/)

(probably somewhere in Mesa3d's source code, too)

devdept
07-21-2007, 02:06 PM
Wonderful! Thanks a lot kon, it is exactly what I was looking for!!!