<?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>glSelectBuffer</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-GL.xml" title="GL"/><link rel="previous" href="glScissor.3G.xml" title="glScissor"/><link rel="next" href="glSeparableFilter2D.3G.xml" title="glSeparableFilter2D"/></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">glSelectBuffer</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="glScissor.3G.xml">Prev</a> </td><th width="60%" align="center">GL</th><td width="20%" align="right"> <a accesskey="n" href="glSeparableFilter2D.3G.xml">Next</a></td></tr></table><hr/></div><div class="refentry" lang="en"><a name="glSelectBuffer.3G"/><div class="titlepage"/><div class="refnamediv"><a name="glSelectBuffer.3G-name"/><h2>Name</h2><p>glSelectBuffer &#8212; establish a buffer for selection mode values</p></div><div class="refsynopsisdiv"><a name="glSelectBuffer.3G-c_spec"/><h2>C Specification</h2><table class="funcprototype" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"><code>void <tt>glSelectBuffer</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>GLsizei <i><tt>size</tt></i>, GLuint *<i><tt>buffer</tt></i>);</code></td></tr></table></div><div class="refsynopsisdiv"><a name="glSelectBuffer.3G-python_spec"/><h2>Python Specification</h2><table class="funcprototype" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"><code><tt>glSelectBuffer</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>size</tt></i>) &#8594; <tt>None</tt></code></td></tr></table></div><div class="refsect1" lang="en"><a name="glSelectBuffer.3G-parameters"/><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><i><tt>size</tt></i></span></dt><dd>
						Specifies the size of <i><tt>buffer</tt></i>.
					</dd><dt><span class="term"><i><tt>buffer</tt></i></span></dt><dd>
						Returns the selection data.
					</dd></dl></div></div><div class="refsect1" lang="en"><a name="glSelectBuffer.3G-description"/><h2>Description</h2><p>
			<tt>glSelectBuffer</tt> has two arguments: <i><tt>buffer</tt></i> is a pointer to an array of
			unsigned integers, and <i><tt>size</tt></i> indicates the size of the array. <i><tt>buffer</tt></i>
			returns values from the name stack (see <a href="glInitNames.3G.xml">glInitNames</a>, <a href="glLoadName.3G.xml"><tt>glLoadName</tt></a>, <a href="glPushName.3G.xml"><tt>glPushName</tt></a>) when the rendering mode is <tt>GL_SELECT</tt> (see
			<a href="glRenderMode.3G.xml">glRenderMode</a>). <tt>glSelectBuffer</tt> must be issued before selection mode is enabled, and it must not
			be issued while the rendering mode is <tt>GL_SELECT</tt>.
		</p><p>
			A programmer can use selection to determine which primitives are drawn into some region of a window. The region is
			defined by the current modelview and perspective matrices.
		</p><p>
			In selection mode, no pixel fragments are produced from rasterization. Instead, if a primitive or a raster position
			intersects the clipping volume defined by the viewing frustum and the user-defined clipping planes, this primitive
			causes a selection hit. (With polygons, no hit occurs if the polygon is culled.) When a change is made to the name
			stack, or when <a href="glRenderMode.3G.xml"><tt>glRenderMode</tt></a> is called, a hit record is copied to
			<i><tt>buffer</tt></i> if any hits have occurred since the last such event (name stack change or <a href="glRenderMode.3G.xml"><tt>glRenderMode</tt></a> call). The hit record consists of the number of names in the name stack at
			the time of the event, followed by the minimum and maximum depth values of all vertices that hit since the previous
			event, followed by the name stack contents, bottom name first.
		</p><p>
			Depth values (which are in the range [0,1]) are multiplied by 2^32 - 1, before being placed in the hit record.
		</p><p>
			An internal index into <i><tt>buffer</tt></i> is reset to 0 whenever selection mode is entered. Each time a hit
			record is copied into <i><tt>buffer</tt></i>, the index is incremented to point to the cell just past the end of
			the block of names - that is, to the next available cell. If the hit record is larger than the number of remaining
			locations in <i><tt>buffer</tt></i>, as much data as can fit is copied, and the overflow flag is set. If the
			name stack is empty when a hit record is copied, that record consists of 0 followed by the minimum and maximum depth
			values.
		</p><p>
			To exit selection mode, call <a href="glRenderMode.3G.xml"><tt>glRenderMode</tt></a> with an argument other than
			<tt>GL_SELECT</tt>. Whenever <a href="glRenderMode.3G.xml"><tt>glRenderMode</tt></a> is called while the
			render mode is <tt>GL_SELECT</tt>, it returns the number of hit records copied to
			<i><tt>buffer</tt></i>, resets the overflow flag and the selection buffer pointer, and initializes the name
			stack to be empty. If the overflow bit was set when <a href="glRenderMode.3G.xml"><tt>glRenderMode</tt></a> was called, a
			negative hit record count is returned.
		</p></div><div class="refsect1" lang="en"><a name="glSelectBuffer.3G-notes"/><h2>Notes</h2><p>
			The contents of <i><tt>buffer</tt></i> is undefined until <a href="glRenderMode.3G.xml"><tt>glRenderMode</tt></a>
			is called with an argument other than <tt>GL_SELECT</tt>.
		</p><p>
			<a href="glBegin.3G.xml"><tt>glBegin</tt></a>/<a href="glBegin.3G.xml"><tt>glEnd</tt></a> primitives and calls to
			<tt>glRasterPos</tt> can result in hits.
		</p></div><div class="refsect1" lang="en"><a name="glSelectBuffer.3G-errors"/><h2>Errors</h2><p>
			<tt>GL_INVALID_VALUE</tt> is generated if <i><tt>size</tt></i> is negative.
		</p><p>
			<tt>GL_INVALID_OPERATION</tt> is generated if <tt>glSelectBuffer</tt> is called while the
			render mode is <tt>GL_SELECT</tt>, or if <a href="glRenderMode.3G.xml"><tt>glRenderMode</tt></a> is called
			with argument <tt>GL_SELECT</tt> before <tt>glSelectBuffer</tt> is called at least once.
		</p><p>
			<tt>GL_INVALID_OPERATION</tt> is generated if <tt>glSelectBuffer</tt> is executed between the
			execution of <a href="glBegin.3G.xml"><tt>glBegin</tt></a> and the corresponding execution of <a href="glBegin.3G.xml"><tt>glEnd</tt></a>.
		</p></div><div class="refsect1" lang="en"><a name="glSelectBuffer.3G-associated_gets"/><h2>Associated Gets</h2><p>
			<tt>glGet</tt> with argument <tt>GL_NAME_STACK_DEPTH</tt>
		</p><p>
			<tt>glGet</tt> with argument <tt>GL_SELECTION_BUFFER_SIZE</tt>
		</p><p>
			<a href="glGetPointerv.3G.xml"><tt>glGetPointerv</tt></a> with argument <tt>GL_SELECTION_BUFFER_POINTER</tt>
		</p></div><div class="refsect1" lang="en"><a name="glSelectBuffer.3G-see_also"/><h2>See Also</h2><p>
			<span class="simplelist"><a href="glFeedbackBuffer.3G.xml">glFeedbackBuffer</a>, <a href="glInitNames.3G.xml">glInitNames</a>, <a href="glLoadName.3G.xml">glLoadName</a>, <a href="glPushName.3G.xml">glPushName</a>, <a href="glRenderMode.3G.xml">glRenderMode</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="glScissor.3G.xml">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="reference-GL.xml">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="glSeparableFilter2D.3G.xml">Next</a></td></tr><tr><td width="40%" align="left" valign="top">glScissor </td><td width="20%" align="center"><a accesskey="h" href="index.xml">Home</a></td><td width="40%" align="right" valign="top"> glSeparableFilter2D</td></tr></table></div></body></html>