1 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN" "xhtml1-transitional.dtd">
2 <!-- saved from url=(0013)about:internet -->
3 <?xml-stylesheet type=
"text/xsl" href=
"mathml.xsl"?><html xmlns=
"http://www.w3.org/1999/xhtml" xmlns:
pref=
"http://www.w3.org/2002/Math/preference" pref:
renderer=
"mathplayer-dl"><head><meta http-equiv=
"Content-Type" content=
"text/html; charset=UTF-8" /><title>gluPickMatrix
</title><meta name=
"generator" content=
"DocBook XSL Stylesheets V1.73.2" /></head><body><div class=
"refentry" lang=
"en" xml:
lang=
"en"><a id=
"gluPickMatrix"></a><div class=
"titlepage"></div><div class=
"refnamediv"><h2>Name
</h2><p>gluPickMatrix — define a picking region
</p></div><div class=
"refsynopsisdiv"><h2>C Specification
</h2><div class=
"funcsynopsis"><table border=
"0" summary=
"Function synopsis" cellspacing=
"0" cellpadding=
"0"><tr><td><code class=
"funcdef">void
<b class=
"fsfunc">gluPickMatrix
</b>(
</code></td><td>GLdouble
</td><td><var class=
"pdparam">x
</var>,
</td></tr><tr><td> </td><td>GLdouble
</td><td><var class=
"pdparam">y
</var>,
</td></tr><tr><td> </td><td>GLdouble
</td><td><var class=
"pdparam">delX
</var>,
</td></tr><tr><td> </td><td>GLdouble
</td><td><var class=
"pdparam">delY
</var>,
</td></tr><tr><td> </td><td>GLint *
</td><td><var class=
"pdparam">viewport
</var><code>)
</code>;
</td></tr></table></div></div><div class=
"refsect1" lang=
"en" xml:
lang=
"en"><a id=
"parameters"></a><h2>Parameters
</h2><div class=
"variablelist"><dl><dt><span class=
"term"><em class=
"parameter"><code>x
</code></em>,
</span><span class=
"term"><em class=
"parameter"><code>y
</code></em></span></dt><dd><p>
4 Specify the center of a picking region in window coordinates.
5 </p></dd><dt><span class=
"term"><em class=
"parameter"><code>delX
</code></em>,
</span><span class=
"term"><em class=
"parameter"><code>delY
</code></em></span></dt><dd><p>
6 Specify the width and height, respectively, of the picking region in window
8 </p></dd><dt><span class=
"term"><em class=
"parameter"><code>viewport
</code></em></span></dt><dd><p>
9 Specifies the current viewport (as from a
<a class=
"citerefentry" href=
"glGetIntegerv.xml"><span class=
"citerefentry"><span class=
"refentrytitle">glGetIntegerv
</span></span></a> call).
10 </p></dd></dl></div></div><div class=
"refsect1" lang=
"en" xml:
lang=
"en"><a id=
"description"></a><h2>Description
</h2><p>
11 <code class=
"function">gluPickMatrix
</code> creates a projection matrix that can be used to restrict drawing
12 to a small region of the viewport.
13 This is typically useful to
14 determine what objects are being drawn near the cursor.
15 Use
<code class=
"function">gluPickMatrix
</code> to
16 restrict drawing to a small region around the cursor.
18 enter selection mode (with
<a class=
"citerefentry" href=
"glRenderMode.xml"><span class=
"citerefentry"><span class=
"refentrytitle">glRenderMode
</span></span></a>) and rerender the scene.
19 All primitives that would have been drawn near
20 the cursor are identified and stored in the selection buffer.
22 The matrix created by
<code class=
"function">gluPickMatrix
</code> is multiplied by the current matrix just
23 as if
<a class=
"citerefentry" href=
"glMultMatrix.xml"><span class=
"citerefentry"><span class=
"refentrytitle">glMultMatrix
</span></span></a> is called with the generated matrix.
24 To effectively use the generated pick matrix for picking,
25 first call
<a class=
"citerefentry" href=
"glLoadIdentity.xml"><span class=
"citerefentry"><span class=
"refentrytitle">glLoadIdentity
</span></span></a> to load an identity matrix onto the
26 perspective matrix stack.
27 Then call
<code class=
"function">gluPickMatrix
</code>,
28 and, finally, call a command (such as
<a class=
"citerefentry" href=
"gluPerspective.xml"><span class=
"citerefentry"><span class=
"refentrytitle">gluPerspective
</span></span></a>)
29 to multiply the perspective matrix by the pick matrix.
31 When using
<code class=
"function">gluPickMatrix
</code> to pick NURBS, be careful to turn off the NURBS
33 <code class=
"constant">GLU_AUTO_LOAD_MATRIX
</code>. If
<code class=
"constant">GLU_AUTO_LOAD_MATRIX
</code> is not
34 turned off, then any NURBS surface rendered is subdivided differently with
35 the pick matrix than the way it was subdivided without the pick matrix.
36 </p></div><div class=
"refsect1" lang=
"en" xml:
lang=
"en"><a id=
"example"></a><h2>Example
</h2><p>
37 When rendering a scene as follows:
38 </p><pre class=
"programlisting">
39 glMatrixMode(GL_PROJECTION);
42 glMatrixMode(GL_MODELVIEW);
45 a portion of the viewport can be selected as a pick region like this:
46 </p><pre class=
"programlisting">
47 glMatrixMode(GL_PROJECTION);
49 gluPickMatrix(x, y, width, height, viewport);
51 glMatrixMode(GL_MODELVIEW);
54 </p></div><div class=
"refsect1" lang=
"en" xml:
lang=
"en"><a id=
"seealso"></a><h2>See Also
</h2><p>
55 <a class=
"citerefentry" href=
"gluPerspective.xml"><span class=
"citerefentry"><span class=
"refentrytitle">gluPerspective
</span></span></a>,
56 <a class=
"citerefentry" href=
"glGet.xml"><span class=
"citerefentry"><span class=
"refentrytitle">glGet
</span></span></a>,
57 <a class=
"citerefentry" href=
"glLoadIdentity.xml"><span class=
"citerefentry"><span class=
"refentrytitle">glLoadIdentity
</span></span></a>,
58 <a class=
"citerefentry" href=
"glMultMatrix.xml"><span class=
"citerefentry"><span class=
"refentrytitle">glMultMatrix
</span></span></a>,
59 <a class=
"citerefentry" href=
"glRenderMode.xml"><span class=
"citerefentry"><span class=
"refentrytitle">glRenderMode
</span></span></a>
60 </p></div><div class=
"refsect1" lang=
"en" xml:
lang=
"en"><a id=
"Copyright"></a><h2>Copyright
</h2><p>
61 Copyright
<span class=
"trademark"></span>©
1991-
2006
62 Silicon Graphics, Inc. This document is licensed under the SGI
63 Free Software B License. For details, see
64 <a class=
"ulink" href=
"http://oss.sgi.com/projects/FreeB/" target=
"_top">http://oss.sgi.com/projects/FreeB/
</a>.
65 </p></div></div></body></html>