gluUnProject4.3   [plain text]


'\" e  
'\"macro stdmacro
.ds Vn Version 1.2
.ds Dt 6 March 1997
.ds Re Release 1.2.0
.ds Dp May 22 14:54
.ds Dm 4 May 22 14:
.ds Xs 13294     5
.TH GLUUNPROJECT4 3G
.SH NAME
.B "gluUnProject4
\- map window and clip coordinates to object coordinates

.SH C SPECIFICATION
GLint \f3gluUnProject4\fP(
GLdouble \fIwinX\fP,
.nf
.ta \w'\f3GLint \fPgluUnProject4( 'u
	GLdouble \fIwinY\fP,
	GLdouble \fIwinZ\fP,
	GLdouble \fIclipW\fP,
	const GLdouble \fI*model\fP,
	const GLdouble \fI*proj\fP,
	const GLint \fI*view\fP,
	GLdouble \fInear\fP,
	GLdouble \fIfar\fP,
	GLdouble* \fIobjX\fP,
	GLdouble* \fIobjY\fP,
	GLdouble* \fIobjZ\fP,
	GLdouble* \fIobjW\fP )
.fi

.EQ
delim $$
.EN
.SH PARAMETERS
.TP \w'\f2winX\fP\ \f2winY\fP\ \f2winZ\fP\ \ 'u 
\f2winX\fP, \f2winY\fP, \f2winZ\fP
Specify the window coordinates to be mapped.
.TP
\f2clipW\fP
Specify the clip w coordinate to be mapped.
.TP
\f2model\fP
Specifies the modelview matrix (as from a \f3glGetDoublev\fP call).
.TP
\f2proj\fP
Specifies the projection matrix (as from a \f3glGetDoublev\fP call).
.TP
\f2view\fP
Specifies the viewport (as from a \f3glGetIntegerv\fP call).
.TP
\f2near\fP, \f2far\fP
Specifies the near and far planes (as from a \f3glGetDoublev\fP call).
.TP
\f2objX\fP, \f2objY\fP, \f2objZ\fP, \f2objW\fP
Returns the computed object coordinates.
.SH DESCRIPTION
\%\f3gluUnProject4\fP maps the specified window coordinates \f2winX\fP, \f2winY\fP and \f2winZ\fP
and its clip w coordinate \f2clipW\fP
into object 
coordinates (\f2objX\fP, \f2objY\fP, \f2objZ\fP, \f2objW\fP)
using \f2model\fP, \f2proj\fP and \f2view\fP. \f2clipW\fP can be other than
1 as for vertices in \f3glFeedbackBuffer\fP when data type 
\%\f3GL_4D_COLOR_TEXTURE\fP is returned.
This also handles the case
where the \f2near\fP and \f2far\fP planes are different from the default,
0 and 1, respectively.
A return 
value of \%\f3GL_TRUE\fP indicates success; a return value of \%\f3GL_FALSE\fP
indicates failure.
.P
To compute the coordinates (\f2objX\fP, \f2objY\fP, \f2objZ\fP and \f2objW\fP),
\%\f3gluUnProject4\fP multiplies the normalized device coordinates by the inverse of
\f2model\fP*\f2proj\fP as follows:

.P
.ce
.EQ
left ( down 70 {cpile { ~"objX" above ~"objY" above ~"objZ"
above ~"objW"}} ~~ 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" ~-~ "near")} over {("far" ~-~ "near")} ~-~ 1 }
above 
"clipW"}} ~~ right )
.EN
.sp
$INV()$ denotes matrix inversion. 
.P
\%\f3gluUnProject4\fP is equivalent to \%\f3gluUnProject\fP when \f2clipW\fP is 1, \f2near\fP is 0 and
\f2far\fP is 1.
.SH NOTES
\%\f3gluUnProject4\fP is available only if the GLU version is 1.3 or greater.
.SH SEE ALSO
\f3glGet\fP,
\f3glFeedbackBuffer\fP,
\%\f3gluProject\fP,
\%\f3gluUnProject\fP