gluProject - map object coordinates to window coordinates
GLint gluProject( | GLfloat | objX, |
| GLfloat | objY, | |
| GLfloat | objZ, | |
| const GLfloat* | model, | |
| const GLfloat* | proj, | |
| const GLint* | view, | |
| GLfloat* | winX, | |
| GLfloat* | winY, | |
| GLfloat* | winZ); |
objX, objY, objZSpecify the object coordinates.
model
Specifies the current modelview matrix (as from a glGetFloatv call, modelview matrix is queriable in OpenGL ES 1.1, not in OpenGL ES 1.0).
proj
Specifies the current projection matrix (as from a glGetFloatv call, projection matrix is queriable in OpenGL ES 1.1, not in OpenGL ES 1.0).
view
Specifies the current viewport (as from a glGetIntegerv call, viewport is queriable in OpenGL ES 1.1, not in OpenGL ES 1.0).
winX, winY, winZReturn the computed window coordinates.
gluProject transforms the specified object coordinates into window coordinates
using model, proj, and view. The result is stored
in winX, winY, and winZ. A return value of
GLU_TRUE indicates success, a return value of GLU_FALSE
indicates failure.
To compute the coordinates,
let v = (objX, objY, objZ, 1.0) represented as a matrix with 4 rows and 1 column.
Then gluProject computes v" as follows:
v" = P x M x v
where P is the current projection matrix proj and M is the current
modelview matrix model (both represented as 4 x 4
matrices in column-major order).
The window coordinates are then computed as follows:
view(2) x (v"(0)+1)
winX = view(0) + ---------------------
2
view(3) x (v"(1)+1)
winY = view(1) + ---------------------
2
(v"(2)+1)
winZ = -----------
2
Copyright c 1991-2006 Silicon Graphics, Inc. This document is licensed under the SGI Free Software B License. For details, see http://oss.sgi.com/projects/FreeB/.