NAME
gluProject
- map object coordinates to window coordinates
C SPECIFICATION
GLint gglluuPPrroojjeecctt(
GLdouble _o_b_j_X,
GLdouble _o_b_j_Y,
GLdouble _o_b_j_Z,
const GLdouble _*_m_o_d_e_l,
const GLdouble _*_p_r_o_j,
const GLint _*_v_i_e_w,
GLdouble* _w_i_n_X,
GLdouble* _w_i_n_Y,
GLdouble* _w_i_n_Z )
delim $$
PARAMETERS
-
_o_b_j_X, _o_b_j_Y, _o_b_j_Z
-
Specify the object coordinates.
-
_m_o_d_e_l
-
Specifies the current modelview matrix (as from a ggllGGeettDDoouubblleevv call).
-
_p_r_o_j
-
Specifies the current projection matrix (as from a ggllGGeettDDoouubblleevv call).
-
_v_i_e_w
-
Specifies the current viewport (as from a ggllGGeettIInntteeggeerrvv call).
-
_w_i_n_X, _w_i_n_Y, _w_i_n_Z
-
Return the computed window coordinates.
DESCRIPTION
gglluuPPrroojjeecctt transforms the specified object coordinates into window coordinates
using _m_o_d_e_l, _p_r_o_j, and _v_i_e_w. The result is stored
in _w_i_n_X, _w_i_n_Y, and _w_i_n_Z. A return value of
GGLL__TTRRUUEE indicates success, a return value of GGLL__FFAALLSSEE
indicates failure.
To compute the coordinates,
let $v ~=~ ("objX", "objY", "objZ", 1.0)$
represented as a matrix with 4 rows and 1 column.
Then gglluuPPrroojjeecctt computes $v sup prime$
as follows:
v sup prime ~=~ P ~times~ M ~times~ v
where $P$ is the current projection matrix _p_r_o_j, $M$ is the current
modelview matrix _m_o_d_e_l (both represented as
$4 times 4$ matrices in column-major order) and '$times$' represents
matrix multiplication.
The window coordinates are then computed as follows:
"winX" ~=~ "view" (0) ~+~ "view" (2) ~*~ (v sup prime (0) ~+~ 1)~/~2
"winY" ~=~ "view" (1) ~+~ "view" (3)~*~(v sup prime (1) ~+~ 1)~/~2
"winZ" ~=~ (v sup prime (2) ~+~ 1)~/~ 2
SEE ALSO
ggllGGeett((33GG)), gglluuUUnnPPrroojjeecctt((33GG))