NAME
gluPickMatrix
- define a picking region
C SPECIFICATION
void gglluuPPiicckkMMaattrriixx(
GLdouble _x,
GLdouble _y,
GLdouble _d_e_l_X,
GLdouble _d_e_l_Y,
GLint _*_v_i_e_w_p_o_r_t )
delim $$
PARAMETERS
-
_x, _y
-
Specify the center of a picking region in window coordinates.
-
_d_e_l_X, _d_e_l_Y
-
Specify the width and height, respectively, of the picking region in window
coordinates.
-
_v_i_e_w_p_o_r_t
-
Specifies the current viewport (as from a ggllGGeettIInntteeggeerrvv call).
DESCRIPTION
gglluuPPiicckkMMaattrriixx creates a projection matrix that can be used to restrict drawing
to a small region of the viewport.
This is typically useful to
determine what objects are being drawn near the cursor.
Use gglluuPPiicckkMMaattrriixx to
restrict drawing to a small region around the cursor.
Then,
enter selection mode (with ggllRReennddeerrMMooddee) and rerender the scene.
All primitives that would have been drawn near
the cursor are identified and stored in the selection buffer.
The matrix created by gglluuPPiicckkMMaattrriixx is multiplied by the current matrix just
as if ggllMMuullttMMaattrriixx is called with the generated matrix.
To effectively use the generated pick matrix for picking,
first call ggllLLooaaddIIddeennttiittyy to load an identity matrix onto the
perspective matrix stack.
Then call gglluuPPiicckkMMaattrriixx,
and finally, call a command (such as gglluuPPeerrssppeeccttiivvee)
to multiply the perspective matrix by the pick matrix.
When using gglluuPPiicckkMMaattrriixx to pick NURBS, be careful to turn off the NURBS
property
GGLLUU__AAUUTTOO__LLOOAADD__MMAATTRRIIXX. If GGLLUU__AAUUTTOO__LLOOAADD__MMAATTRRIIXX is not
turned off, then any NURBS surface rendered is subdivided differently with
the pick matrix than the way it was subdivided without the pick matrix.
EXAMPLE
When rendering a scene as follows:
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(...);
glMatrixMode(GL_MODELVIEW);
a portion of the viewport can be selected as a pick region like this:
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPickMatrix(x, y, width, height, viewport);
gluPerspective(...);
glMatrixMode(GL_MODELVIEW);
SEE ALSO
ggllGGeett((33GG)),
ggllLLooaaddIInnddeennttiittyy((33GG)),
ggllMMuullttMMaattrriixx((33GG)),
ggllRReennddeerrMMooddee((33GG)),
gglluuPPeerrssppeeccttiivvee((33GG))