summaryrefslogtreecommitdiff
path: root/doc/gl-docs/GLU/unproject4.3gl
blob: 72e755d2c3089b7bd336cf583ed827e29fb82efd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
'\" e
'\"! eqn | mmdoc
'\"macro stdmacro
.ds Vn Version 1.2
.ds Dt 6 March 1997
.ds Re Release 1.2.0
.ds Dp May 02 11:53
.ds Dm 37 unproject
.ds Xs 13294 5 unproject4.gl
.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(3G)\fP,
\f3glFeedbackBuffer(3G)\fP,
\%\f3gluProject(3G)\fP,
\%\f3gluUnProject(3G)\fP