<?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>glAccum</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="reference-GL.xml" title="GL"/><link rel="next" href="glActiveTextureARB.3G.xml" title="glActiveTextureARB"/></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">glAccum</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="reference-GL.xml">Prev</a> </td><th width="60%" align="center">GL</th><td width="20%" align="right"> <a accesskey="n" href="glActiveTextureARB.3G.xml">Next</a></td></tr></table><hr/></div><div class="refentry" lang="en"><a name="glAccum.3G"/><div class="titlepage"/><div class="refnamediv"><a name="glAccum.3G-name"/><h2>Name</h2><p>glAccum &#8212; operate on the accumulation buffer</p></div><div class="refsynopsisdiv"><a name="glAccum.3G-c_spec"/><h2>C Specification</h2><table class="funcprototype" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"><code>void <tt>glAccum</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>GLenum <i><tt>op</tt></i>, GLfloat <i><tt>value</tt></i>);</code></td></tr></table></div><div class="refsynopsisdiv"><a name="glAccum.3G-python_spec"/><h2>Python Specification</h2><table class="funcprototype" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"><code><tt>glAccum</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>op</tt></i>, <i><tt>value</tt></i>) &#8594; <tt>None</tt></code></td></tr></table></div><div class="refsect1" lang="en"><a name="glAccum.3G-parameters"/><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><i><tt>op</tt></i></span></dt><dd>
						Specifies the accumulation buffer operation. Symbolic constants <tt>GL_ACCUM</tt>,
						<tt>GL_LOAD</tt>, <tt>GL_ADD</tt>, <tt>GL_MULT</tt>, and
						<tt>GL_RETURN</tt> are accepted.
					</dd><dt><span class="term"><i><tt>value</tt></i></span></dt><dd>
						Specifies a floating-point value used in the accumulation buffer operation. <i><tt>op</tt></i>
						determines how <i><tt>value</tt></i> is used.
					</dd></dl></div></div><div class="refsect1" lang="en"><a name="glAccum.3G-description"/><h2>Description</h2><p>
			The accumulation buffer is an extended-range color buffer. Images are not rendered into it. Rather, images rendered
			into one of the color buffers are added to the contents of the accumulation buffer after rendering. Effects such as
			antialiasing (of points, lines, and polygons), motion blur, and depth of field can be created by accumulating images
			generated with different transformation matrices.
		</p><p>
			Each pixel in the accumulation buffer consists of red, green, blue, and alpha values. The number of bits per component
			in the accumulation buffer depends on the implementation. You can examine this number by calling <a href="glGet.3G.xml"><tt>glGetIntegerv</tt></a> four times, with arguments <tt>GL_ACCUM_RED_BITS</tt>,
			<tt>GL_ACCUM_GREEN_BITS</tt>, <tt>GL_ACCUM_BLUE_BITS</tt>, and
			<tt>GL_ACCUM_ALPHA_BITS</tt>. Regardless of the number of bits per component, the range of values stored by
			each component is <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
					<mml:mfenced separator="," open="[" close="]">
						<mml:mn>-1</mml:mn>
						<mml:mn>1</mml:mn>
					</mml:mfenced>
				</mml:math>. The accumulation buffer pixels are mapped one-to-one with frame buffer pixels.
		</p><p>
			<tt>glAccum</tt> operates on the accumulation buffer. The first argument, <i><tt>op</tt></i>, is a
			symbolic constant that selects an accumulation buffer operation. The second argument, <i><tt>value</tt></i>, is
			a floating-point value to be used in that operation. Five operations are specified: <tt>GL_ACCUM</tt>,
			<tt>GL_LOAD</tt>, <tt>GL_ADD</tt>, <tt>GL_MULT</tt>, and
			<tt>GL_RETURN</tt>.
		</p><p>
			All accumulation buffer operations are limited to the area of the current scissor box and applied identically to the
			red, green, blue, and alpha components of each pixel. If a <tt>glAccum</tt> operation results in a value
			outside the range <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
					<mml:mfenced separator="," open="[" close="]">
						<mml:mn>-1</mml:mn>
						<mml:mn>1</mml:mn>
					</mml:mfenced>
				</mml:math>, the contents of an accumulation buffer pixel component are undefined.
		</p><p>
			The operations are as follows:
		</p><div class="variablelist"><dl><dt><span class="term"><tt>GL_ACCUM</tt></span></dt><dd>
						Obtains R, G, B, and A values from the buffer currently selected for reading (see <a href="glReadBuffer.3G.xml">glReadBuffer</a>). Each component value is divided by <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
								<mml:msup>
									<mml:mn>2</mml:mn>
									<mml:mi>n</mml:mi>
								</mml:msup>
								<mml:mo>-</mml:mo>
								<mml:mn>1</mml:mn>
							</mml:math>, where <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
								<mml:mi>n</mml:mi>
							</mml:math> is the number of bits allocated to each color component in the currently selected buffer.
						The result is a floating-point value in the range <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
								<mml:mfenced separator="," open="[" close="]">
									<mml:mn>0</mml:mn>
									<mml:mn>1</mml:mn>
								</mml:mfenced>
							</mml:math>, which is multiplied by <i><tt>value</tt></i> and added to the corresponding pixel
						component in the accumulation buffer, thereby updating the accumulation buffer.
					</dd><dt><span class="term"><tt>GL_LOAD</tt></span></dt><dd>
						Similar to <tt>GL_ACCUM</tt>, except that the current value in the accumulation buffer is not
						used in the calculation of the new value. That is, the R, G, B, and A values from the currently selected
						buffer are divided by <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
								<mml:msup>
									<mml:mn>2</mml:mn>
									<mml:mi>n</mml:mi>
								</mml:msup>
								<mml:mo>-</mml:mo>
								<mml:mn>1</mml:mn>
							</mml:math>, multiplied by <i><tt>value</tt></i>, and then stored in the corresponding
						accumulation buffer cell, overwriting the current value.
					</dd><dt><span class="term"><tt>GL_ADD</tt></span></dt><dd>
						Adds <i><tt>value</tt></i> to each R, G, B, and A in the accumulation buffer.
					</dd><dt><span class="term"><tt>GL_MULT</tt></span></dt><dd>
						Multiplies each R, G, B, and A in the accumulation buffer by <i><tt>value</tt></i> and returns the
						scaled component to its corresponding accumulation buffer location.
					</dd><dt><span class="term"><tt>GL_RETURN</tt></span></dt><dd>
						Transfers accumulation buffer values to the color buffer or buffers currently selected for writing. Each R,
						G, B, and A component is multiplied by <i><tt>value</tt></i>, then multiplied by <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
								<mml:msup>
									<mml:mn>2</mml:mn>
									<mml:mi>n</mml:mi>
								</mml:msup>
								<mml:mo>-</mml:mo>
								<mml:mn>1</mml:mn>
							</mml:math>, clamped to the range <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
								<mml:mfenced separator="," open="[" close="]">
									<mml:mn>0</mml:mn>
									<mml:mrow>
										<mml:msup>
											<mml:mn>2</mml:mn>
											<mml:mi>n</mml:mi>
										</mml:msup>
										<mml:mo>-</mml:mo>
										<mml:mn>1</mml:mn>
									</mml:mrow>
								</mml:mfenced>
							</mml:math>, and stored in the corresponding display buffer cell. The only fragment operations that
						are applied to this transfer are pixel ownership, scissor, dithering, and color writemasks.
					</dd></dl></div><p>
			To clear the accumulation buffer, call <a href="glClearAccum.3G.xml"><tt>glClearAccum</tt></a> with R, G, B, and A values
			to set it to, then call <a href="glClear.3G.xml"><tt>glClear</tt></a> with the accumulation buffer enabled.
		</p></div><div class="refsect1" lang="en"><a name="glAccum.3G-notes"/><h2>Notes</h2><p>
			Only pixels within the current scissor box are updated by a <tt>glAccum</tt> operation.
		</p></div><div class="refsect1" lang="en"><a name="glAccum.3G-errors"/><h2>Errors</h2><p>
			<tt>GL_INVALID_ENUM</tt> is generated if <i><tt>op</tt></i> is not an accepted value.
		</p><p>
			<tt>GL_INVALID_OPERATION</tt> is generated if there is no accumulation buffer.
		</p><p>
			<tt>GL_INVALID_OPERATION</tt> is generated if <tt>glAccum</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="glAccum.3G-associated_gets"/><h2>Associated Gets</h2><p>
			<tt>glGet</tt> with argument <tt>GL_ACCUM_RED_BITS</tt>
		</p><p>
			<tt>glGet</tt> with argument <tt>GL_ACCUM_GREEN_BITS</tt>
		</p><p>
			<tt>glGet</tt> with argument <tt>GL_ACCUM_BLUE_BITS</tt>
		</p><p>
			<tt>glGet</tt> with argument <tt>GL_ACCUM_ALPHA_BITS</tt>
		</p></div><div class="refsect1" lang="en"><a name="glAccum.3G-see_also"/><h2>See Also</h2><p>
			<span class="simplelist"><a href="glClear.3G.xml">glClear</a>, <a href="glClearAccum.3G.xml">glClearAccum</a>, <a href="glCopyPixels.3G.xml">glCopyPixels</a>, <a href="glDrawBuffer.3G.xml">glDrawBuffer</a>, <a href="glGet.3G.xml">glGet</a>, <a href="glReadBuffer.3G.xml">glReadBuffer</a>, <a href="glReadPixels.3G.xml">glReadPixels</a>, <a href="glScissor.3G.xml">glScissor</a>, <a href="glStencilOp.3G.xml">glStencilOp</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="reference-GL.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="glActiveTextureARB.3G.xml">Next</a></td></tr><tr><td width="40%" align="left" valign="top">GL </td><td width="20%" align="center"><a accesskey="h" href="index.xml">Home</a></td><td width="40%" align="right" valign="top"> glActiveTextureARB</td></tr></table></div></body></html>