<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html
  PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN" "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd">
<html
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:mml="http://www.w3.org/1998/Math/MathML"
><head><title>gluPickMatrix</title><link rel="stylesheet" href="style.css" type="text/css"/><meta name="generator" content="DocBook XSL Stylesheets V1.59.1"/><link rel="home" href="index.xml" title="PyOpenGL 2.0.1.07 Man Pages"/><link rel="up" href="reference-GLU.xml" title="GLU"/><link rel="previous" href="gluPerspective.3G.xml" title="gluPerspective"/><link rel="next" href="gluProject.3G.xml" title="gluProject"/></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">gluPickMatrix</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="gluPerspective.3G.xml">Prev</a> </td><th width="60%" align="center">GLU</th><td width="20%" align="right"> <a accesskey="n" href="gluProject.3G.xml">Next</a></td></tr></table><hr/></div><div class="refentry" lang="en"><a name="gluPickMatrix.3G"/><div class="titlepage"/><div class="refnamediv"><a name="gluPickMatrix.3G-name"/><h2>Name</h2><p>gluPickMatrix &#8212; define a picking region</p></div><div class="refsynopsisdiv"><a name="gluPickMatrix.3G-c_spec"/><h2>C Specification</h2><table class="funcprototype" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"><code>void <tt>gluPickMatrix</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>GLdouble <i><tt>x</tt></i>, GLdouble <i><tt>y</tt></i>, GLdouble <i><tt>delX</tt></i>, GLdouble <i><tt>delY</tt></i>, GLint *<i><tt>viewport</tt></i>);</code></td></tr></table></div><div class="refsynopsisdiv"><a name="gluPickMatrix.3G-python_spec"/><h2>Python Specification</h2><table class="funcprototype" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"><code><tt>gluPickMatrix</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>x</tt></i>, <i><tt>y</tt></i>, <i><tt>delX</tt></i>, <i><tt>delY</tt></i>, <i><tt>viewport</tt></i> = <tt>None</tt>) &#8594; <tt>None</tt></code></td></tr></table></div><div class="refsect1" lang="en"><a name="gluPickMatrix.3G-parameters"/><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><i><tt>x</tt></i>, <i><tt>y</tt></i></span></dt><dd>
						Specify the center of a picking region in window coordinates.
					</dd><dt><span class="term"><i><tt>delX</tt></i>, <i><tt>delY</tt></i></span></dt><dd>
						Specify the width and height, respectively, of the picking region in window coordinates.
					</dd><dt><span class="term"><i><tt>viewport</tt></i></span></dt><dd>
						Specifies the current viewport (as from a <a href="glGet.3G.xml"><tt>glGetIntegerv</tt></a> call).
					</dd></dl></div></div><div class="refsect1" lang="en"><a name="gluPickMatrix.3G-description"/><h2>Description</h2><p>
			<tt>gluPickMatrix</tt> 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
			<tt>gluPickMatrix</tt> to restrict drawing to a small region around the cursor. Then, enter selection mode
			(with <a href="glRenderMode.3G.xml"><tt>glRenderMode</tt></a>) and rerender the scene. All primitives that would have
			been drawn near the cursor are identified and stored in the selection buffer.
		</p><p>
			The matrix created by <tt>gluPickMatrix</tt> is multiplied by the current matrix just as if <tt>glMultMatrix</tt> is called with the generated matrix. To effectively use the generated pick
			matrix for picking, first call <a href="glLoadIdentity.3G.xml"><tt>glLoadIdentity</tt></a> to load an identity matrix onto
			the perspective matrix stack. Then call <tt>gluPickMatrix</tt>, and finally, call a command (such as
			<a href="gluPerspective.3G.xml"><tt>gluPerspective</tt></a>) to multiply the perspective matrix by the pick matrix.
		</p><p>
			When using <tt>gluPickMatrix</tt> to pick NURBS, be careful to turn off the NURBS property
			<tt>GLU_AUTO_LOAD_MATRIX</tt>. If <tt>GLU_AUTO_LOAD_MATRIX</tt> 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.
		</p></div><div class="refsect1" lang="en"><a name="gluPickMatrix.3G-example"/><h2>Example</h2><p>
			When rendering a scene as follows: glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(...);
			glMatrixMode(GL_MODELVIEW); /* Draw the scene */ 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); /* Draw the scene */
		</p></div><div class="refsect1" lang="en"><a name="gluPickMatrix.3G-see_also"/><h2>See Also</h2><p>
			<span class="simplelist"><a href="glGet.3G.xml">glGet</a>, <a href="glLoadIdentity.3G.xml">glLoadIdentity</a>, <a href="glMultMatrix.3G.xml">glMultMatrix</a>, <a href="glRenderMode.3G.xml">glRenderMode</a>, <a href="gluPerspective.3G.xml">gluPerspective</a></span>
		</p></div></div><div class="navfooter"><hr/><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="gluPerspective.3G.xml">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="reference-GLU.xml">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="gluProject.3G.xml">Next</a></td></tr><tr><td width="40%" align="left" valign="top">gluPerspective </td><td width="20%" align="center"><a accesskey="h" href="index.xml">Home</a></td><td width="40%" align="right" valign="top"> gluProject</td></tr></table></div></body></html>