1 <?xml version=
"1.0" encoding=
"UTF-8"?>
2 <!DOCTYPE book PUBLIC
"-//OASIS//DTD DocBook MathML Module V1.1b1//EN"
3 "http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd">
4 <refentry id=
"gluPickMatrix">
9 <holder>Silicon Graphics, Inc.
</holder>
12 <refentrytitle>gluPickMatrix
</refentrytitle>
13 <manvolnum>3G
</manvolnum>
16 <refname>gluPickMatrix
</refname>
17 <refpurpose>define a picking region
</refpurpose>
19 <refsynopsisdiv><title>C Specification
</title>
22 <funcdef>void
<function>gluPickMatrix
</function></funcdef>
23 <paramdef>GLdouble
<parameter>x
</parameter></paramdef>
24 <paramdef>GLdouble
<parameter>y
</parameter></paramdef>
25 <paramdef>GLdouble
<parameter>delX
</parameter></paramdef>
26 <paramdef>GLdouble
<parameter>delY
</parameter></paramdef>
27 <paramdef>GLint *
<parameter>viewport
</parameter></paramdef>
31 <!-- eqn: ignoring delim $$ -->
32 <refsect1 id=
"parameters"><title>Parameters
</title>
35 <term><parameter>x
</parameter></term>
36 <term><parameter>y
</parameter></term>
39 Specify the center of a picking region in window coordinates.
44 <term><parameter>delX
</parameter></term>
45 <term><parameter>delY
</parameter></term>
48 Specify the width and height, respectively, of the picking region in window
54 <term><parameter>viewport
</parameter></term>
57 Specifies the current viewport (as from a
<citerefentry><refentrytitle>glGetIntegerv
</refentrytitle></citerefentry> call).
63 <refsect1 id=
"description"><title>Description
</title>
65 <function>gluPickMatrix
</function> creates a projection matrix that can be used to restrict drawing
66 to a small region of the viewport.
67 This is typically useful to
68 determine what objects are being drawn near the cursor.
69 Use
<function>gluPickMatrix
</function> to
70 restrict drawing to a small region around the cursor.
72 enter selection mode (with
<citerefentry><refentrytitle>glRenderMode
</refentrytitle></citerefentry>) and rerender the scene.
73 All primitives that would have been drawn near
74 the cursor are identified and stored in the selection buffer.
77 The matrix created by
<function>gluPickMatrix
</function> is multiplied by the current matrix just
78 as if
<citerefentry><refentrytitle>glMultMatrix
</refentrytitle></citerefentry> is called with the generated matrix.
79 To effectively use the generated pick matrix for picking,
80 first call
<citerefentry><refentrytitle>glLoadIdentity
</refentrytitle></citerefentry> to load an identity matrix onto the
81 perspective matrix stack.
82 Then call
<function>gluPickMatrix
</function>,
83 and, finally, call a command (such as
<citerefentry><refentrytitle>gluPerspective
</refentrytitle></citerefentry>)
84 to multiply the perspective matrix by the pick matrix.
87 When using
<function>gluPickMatrix
</function> to pick NURBS, be careful to turn off the NURBS
89 <constant>GLU_AUTO_LOAD_MATRIX
</constant>. If
<constant>GLU_AUTO_LOAD_MATRIX
</constant> is not
90 turned off, then any NURBS surface rendered is subdivided differently with
91 the pick matrix than the way it was subdivided without the pick matrix.
94 <refsect1 id=
"example"><title>Example
</title>
96 When rendering a scene as follows:
98 glMatrixMode(GL_PROJECTION);
101 glMatrixMode(GL_MODELVIEW);
104 a portion of the viewport can be selected as a pick region like this:
106 glMatrixMode(GL_PROJECTION);
108 gluPickMatrix(x, y, width, height, viewport);
110 glMatrixMode(GL_MODELVIEW);
115 <refsect1 id=
"seealso"><title>See Also
</title>
117 <citerefentry><refentrytitle>gluPerspective
</refentrytitle></citerefentry>,
118 <citerefentry><refentrytitle>glGet
</refentrytitle></citerefentry>,
119 <citerefentry><refentrytitle>glLoadIdentity
</refentrytitle></citerefentry>,
120 <citerefentry><refentrytitle>glMultMatrix
</refentrytitle></citerefentry>,
121 <citerefentry><refentrytitle>glRenderMode
</refentrytitle></citerefentry>
124 <refsect1 id=
"Copyright"><title>Copyright
</title>
126 Copyright
<trademark class=
"copyright"></trademark> 1991-
2006
127 Silicon Graphics, Inc. This document is licensed under the SGI
128 Free Software B License. For details, see
129 <ulink url=
"http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/
</ulink>.