9
.ds Xs 21974 4 project.gl
13
\- map object coordinates to window coordinates
16
GLint \f3gluProject\fP(
19
.ta \w'\f3GLint \fPgluProject( 'u
22
const GLdouble \fI*model\fP,
23
const GLdouble \fI*proj\fP,
24
const GLint \fI*view\fP,
27
GLdouble* \fIwinZ\fP )
34
.TP \w'\f2objX\fP\ \f2objY\fP\ \f2objZ\fP\ \ 'u
35
\f2objX\fP, \f2objY\fP, \f2objZ\fP
36
Specify the object coordinates.
39
Specifies the current modelview matrix (as from a \f3glGetDoublev\fP call).
42
Specifies the current projection matrix (as from a \f3glGetDoublev\fP call).
45
Specifies the current viewport (as from a \f3glGetIntegerv\fP call).
47
\f2winX\fP, \f2winY\fP, \f2winZ\fP
48
Return the computed window coordinates.
50
\%\f3gluProject\fP transforms the specified object coordinates into window coordinates
51
using \f2model\fP, \f2proj\fP, and \f2view\fP. The result is stored
52
in \f2winX\fP, \f2winY\fP, and \f2winZ\fP. A return value of
53
\%\f3GL_TRUE\fP indicates success, a return value of \%\f3GL_FALSE\fP
56
To compute the coordinates,
57
let $v ~=~ ("objX", "objY", "objZ", 1.0)$
58
represented as a matrix with 4 rows and 1 column.
59
Then \%\f3gluProject\fP computes $v sup prime$
63
v sup prime ~=~ P ~times~ M ~times~ v
66
where $P$ is the current projection matrix \f2proj\fP, $M$ is the current
67
modelview matrix \f2model\fP (both represented as
68
$4 times 4$ matrices in column-major order) and '$times$' represents
69
matrix multiplication.
71
The window coordinates are then computed as follows:
74
"winX" ~=~ "view" (0) ~+~ "view" (2) ~*~ (v sup prime (0) ~+~ 1)~/~2
78
"winY" ~=~ "view" (1) ~+~ "view" (3)~*~(v sup prime (1) ~+~ 1)~/~2 .EN
81
"winZ" ~=~ (v sup prime (2) ~+~ 1)~/~ 2
85
\f3glGet(3G)\fP, \%\f3gluUnProject(3G)\fP