1GLUPROJECT(3G) GLUPROJECT(3G)
2
3
4
6 gluProject - map object coordinates to window coordinates
7
8
10 GLint gluProject( GLdouble objX,
11 GLdouble objY,
12 GLdouble objZ,
13 const GLdouble *model,
14 const GLdouble *proj,
15 const GLint *view,
16 GLdouble* winX,
17 GLdouble* winY,
18 GLdouble* winZ )
19
20 delim $$
21
23 objX, objY, objZ
24 Specify the object coordinates.
25
26 model Specifies the current modelview matrix (as from a
27 glGetDoublev call).
28
29 proj Specifies the current projection matrix (as from a
30 glGetDoublev call).
31
32 view Specifies the current viewport (as from a glGetIntegerv
33 call).
34
35 winX, winY, winZ
36 Return the computed window coordinates.
37
39 gluProject transforms the specified object coordinates into window
40 coordinates using model, proj, and view. The result is stored in winX,
41 winY, and winZ. A return value of GL_TRUE indicates success, a return
42 value of GL_FALSE indicates failure.
43
44 To compute the coordinates, let $v ~=~ ("objX", "objY", "objZ", 1.0)$
45 represented as a matrix with 4 rows and 1 column. Then gluProject com‐
46 putes $v sup prime$ as follows:
47
48 v sup prime ~=~ P ~times~ M ~times~ v
49
50 where $P$ is the current projection matrix proj, $M$ is the current
51 modelview matrix model (both represented as $4 times 4$ matrices in
52 column-major order) and '$times$' represents matrix multiplication.
53
54 The window coordinates are then computed as follows:
55
56 "winX" ~=~ "view" (0) ~+~ "view" (2) ~*~ (v sup prime (0) ~+~ 1)~/~2
57
58 "winY" ~=~ "view" (1) ~+~ "view" (3)~*~(v sup prime (1) ~+~ 1)~/~2
59
60 "winZ" ~=~ (v sup prime (2) ~+~ 1)~/~ 2
61
62
64 glGet(3G), gluUnProject(3G)
65
66
67
68
69 GLUPROJECT(3G)