NAME
gluUnProject
- map window coordinates to object coordinates
C SPECIFICATION
GLint gglluuUUnnPPrroojjeecctt(
GLdouble _w_i_n_X,
GLdouble _w_i_n_Y,
GLdouble _w_i_n_Z,
const GLdouble _*_m_o_d_e_l,
const GLdouble _*_p_r_o_j,
const GLint _*_v_i_e_w,
GLdouble* _o_b_j_X,
GLdouble* _o_b_j_Y,
GLdouble* _o_b_j_Z )
delim $$
PARAMETERS
-
_w_i_n_X, _w_i_n_Y, _w_i_n_Z
-
Specify the window coordinates to be mapped.
-
_m_o_d_e_l
-
Specifies the modelview matrix (as from a ggllGGeettDDoouubblleevv call).
-
_p_r_o_j
-
Specifies the projection matrix (as from a ggllGGeettDDoouubblleevv call).
-
_v_i_e_w
-
Specifies the viewport (as from a ggllGGeettIInntteeggeerrvv call).
-
_o_b_j_X, _o_b_j_Y, _o_b_j_Z
-
Returns the computed object coordinates.
DESCRIPTION
gglluuUUnnPPrroojjeecctt maps the specified window coordinates into object
coordinates using _m_o_d_e_l, _p_r_o_j, and _v_i_e_w.
The result is stored in _o_b_j_X, _o_b_j_Y, and _o_b_j_Z. A return value of
GGLL__TTRRUUEE indicates success; a return value of GGLL__FFAALLSSEE
indicates failure.
To compute the coordinates (_o_b_j_X, _o_b_j_Y, and _o_b_j_Z),
gglluuUUnnPPrroojjeecctt multiplies the normalized device coordinates by the inverse of
_m_o_d_e_l*_p_r_o_j as follows:
left ( down 70 {cpile { ~"objX" above ~"objY" above ~"objZ"
above ~W}} ~~ right ) ~=~ INV(P M)
left ( down 140 {cpile {
{ {2("winX" ~-~ "view"[0])} over {"view" [2]} ~-~ 1 }
above
{ {2("winY" ~-~ "view"[1])} over {"view"[3]} ~-~ 1 }
above
{ 2("winZ") ~-~ 1 }
above
1}} ~~ right )
$INV()$ denotes matrix inversion.
W is an unused variable, included for consistent matrix notation.
SEE ALSO
ggllGGeett((33GG)), gglluuPPrroojjeecctt((33GG))