Opentk/Source/Bind/Specifications/Docs/gluPickMatrix.xml
2009-03-08 00:46:58 +00:00

132 lines
5.9 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook MathML Module V1.1b1//EN"
"http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd">
<refentry id="gluPickMatrix">
<refmeta>
<refmetainfo>
<copyright>
<year>1991-2006</year>
<holder>Silicon Graphics, Inc.</holder>
</copyright>
</refmetainfo>
<refentrytitle>gluPickMatrix</refentrytitle>
<manvolnum>3G</manvolnum>
</refmeta>
<refnamediv>
<refname>gluPickMatrix</refname>
<refpurpose>define a picking region</refpurpose>
</refnamediv>
<refsynopsisdiv><title>C Specification</title>
<funcsynopsis>
<funcprototype>
<funcdef>void <function>gluPickMatrix</function></funcdef>
<paramdef>GLdouble <parameter>x</parameter></paramdef>
<paramdef>GLdouble <parameter>y</parameter></paramdef>
<paramdef>GLdouble <parameter>delX</parameter></paramdef>
<paramdef>GLdouble <parameter>delY</parameter></paramdef>
<paramdef>GLint * <parameter>viewport</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<!-- eqn: ignoring delim $$ -->
<refsect1 id="parameters"><title>Parameters</title>
<variablelist>
<varlistentry>
<term><parameter>x</parameter></term>
<term><parameter>y</parameter></term>
<listitem>
<para>
Specify the center of a picking region in window coordinates.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>delX</parameter></term>
<term><parameter>delY</parameter></term>
<listitem>
<para>
Specify the width and height, respectively, of the picking region in window
coordinates.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>viewport</parameter></term>
<listitem>
<para>
Specifies the current viewport (as from a <citerefentry><refentrytitle>glGetIntegerv</refentrytitle></citerefentry> call).
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 id="description"><title>Description</title>
<para>
<function>gluPickMatrix</function> 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 <function>gluPickMatrix</function> to
restrict drawing to a small region around the cursor.
Then,
enter selection mode (with <citerefentry><refentrytitle>glRenderMode</refentrytitle></citerefentry>) and rerender the scene.
All primitives that would have been drawn near
the cursor are identified and stored in the selection buffer.
</para>
<para>
The matrix created by <function>gluPickMatrix</function> is multiplied by the current matrix just
as if <citerefentry><refentrytitle>glMultMatrix</refentrytitle></citerefentry> is called with the generated matrix.
To effectively use the generated pick matrix for picking,
first call <citerefentry><refentrytitle>glLoadIdentity</refentrytitle></citerefentry> to load an identity matrix onto the
perspective matrix stack.
Then call <function>gluPickMatrix</function>,
and, finally, call a command (such as <citerefentry><refentrytitle>gluPerspective</refentrytitle></citerefentry>)
to multiply the perspective matrix by the pick matrix.
</para>
<para>
When using <function>gluPickMatrix</function> to pick NURBS, be careful to turn off the NURBS
property
<constant>GLU_AUTO_LOAD_MATRIX</constant>. If <constant>GLU_AUTO_LOAD_MATRIX</constant> 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.
</para>
</refsect1>
<refsect1 id="example"><title>Example</title>
<para>
When rendering a scene as follows:
<programlisting>
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(...);
glMatrixMode(GL_MODELVIEW);
/* Draw the scene */
</programlisting>
a portion of the viewport can be selected as a pick region like this:
<programlisting>
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPickMatrix(x, y, width, height, viewport);
gluPerspective(...);
glMatrixMode(GL_MODELVIEW);
/* Draw the scene */
</programlisting>
</para>
</refsect1>
<refsect1 id="seealso"><title>See Also</title>
<para>
<citerefentry><refentrytitle>gluPerspective</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glGet</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glLoadIdentity</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glMultMatrix</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glRenderMode</refentrytitle></citerefentry>
</para>
</refsect1>
<refsect1 id="Copyright"><title>Copyright</title>
<para>
Copyright <trademark class="copyright"></trademark> 1991-2006
Silicon Graphics, Inc. This document is licensed under the SGI
Free Software B License. For details, see
<ulink url="http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/</ulink>.
</para>
</refsect1>
</refentry>