-
Notifications
You must be signed in to change notification settings - Fork 94
/
glAccum.xhtml
198 lines (191 loc) · 13.8 KB
/
glAccum.xhtml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
<div class="refentry" lang="en" xml:lang="en"><a id="glAccum"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>glAccum — operate on the accumulation buffer</p></div><div class="refsynopsisdiv"><h2>C Specification</h2><div class="funcsynopsis"><table><tr><td><code class="funcdef">void <b class="fsfunc">glAccum</b>(</code></td><td>GLenum </td><td><var class="pdparam">op</var>, </td></tr><tr><td> </td><td>GLfloat </td><td><var class="pdparam">value</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>op</code></em></span></dt><dd><p>
Specifies the accumulation buffer operation.
Symbolic constants
<code class="constant">GL_ACCUM</code>,
<code class="constant">GL_LOAD</code>,
<code class="constant">GL_ADD</code>,
<code class="constant">GL_MULT</code>,
and
<code class="constant">GL_RETURN</code> are accepted.
</p></dd><dt><span class="term"><em class="parameter"><code>value</code></em></span></dt><dd><p>
Specifies a floating-point value used in the accumulation buffer operation.
<em class="parameter"><code>op</code></em> determines how <em class="parameter"><code>value</code></em> is used.
</p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><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 class="citerefentry" href="glGetIntegerv"><span class="citerefentry"><span class="refentrytitle">glGetIntegerv</span></span></a> four times,
with arguments <code class="constant">GL_ACCUM_RED_BITS</code>,
<code class="constant">GL_ACCUM_GREEN_BITS</code>,
<code class="constant">GL_ACCUM_BLUE_BITS</code>,
and <code class="constant">GL_ACCUM_ALPHA_BITS</code>.
Regardless of the number of bits per component,
the range of values stored by each component is
<math overflow="scroll">
<mfenced open="[" close="]">
<mn>-1</mn>
<mn>1</mn>
</mfenced>
</math>.
The accumulation buffer pixels are mapped one-to-one with frame buffer pixels.
</p><p>
<code class="function">glAccum</code> operates on the accumulation buffer.
The first argument, <em class="parameter"><code>op</code></em>,
is a symbolic constant that selects an accumulation buffer operation.
The second argument, <em class="parameter"><code>value</code></em>,
is a floating-point value to be used in that operation.
Five operations are specified:
<code class="constant">GL_ACCUM</code>, <code class="constant">GL_LOAD</code>, <code class="constant">GL_ADD</code>,
<code class="constant">GL_MULT</code>, and <code class="constant">GL_RETURN</code>.
</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 <code class="function">glAccum</code> operation results in a value outside the range
<math overflow="scroll">
<mfenced open="[" close="]">
<mn>-1</mn>
<mn>1</mn>
</mfenced>
</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"><code class="constant">GL_ACCUM</code></span></dt><dd><p>
Obtains R, G, B, and A values
from the buffer currently selected for reading (see <a class="citerefentry" href="glReadBuffer"><span class="citerefentry"><span class="refentrytitle">glReadBuffer</span></span></a>).
Each component value is divided by
<math overflow="scroll">
<mrow>
<msup><mn>2</mn>
<mi mathvariant="italic">n</mi>
</msup>
<mo>-</mo>
<mn>1</mn>
</mrow>
</math>,
where
<math overflow="scroll"><mi mathvariant="italic">n</mi></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
<math overflow="scroll">
<mfenced open="[" close="]">
<mn>0</mn>
<mn>1</mn>
</mfenced>
</math>,
which is multiplied by <em class="parameter"><code>value</code></em> and added to the corresponding pixel component
in the accumulation buffer,
thereby updating the accumulation buffer.
</p></dd><dt><span class="term"><code class="constant">GL_LOAD</code></span></dt><dd><p>
Similar to <code class="constant">GL_ACCUM</code>,
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
<math overflow="scroll">
<mrow>
<msup><mn>2</mn>
<mi mathvariant="italic">n</mi>
</msup>
<mo>-</mo>
<mn>1</mn>
</mrow>
</math>,
multiplied by <em class="parameter"><code>value</code></em>,
and then stored in the corresponding accumulation buffer cell,
overwriting the current value.
</p></dd><dt><span class="term"><code class="constant">GL_ADD</code></span></dt><dd><p>
Adds <em class="parameter"><code>value</code></em> to each R, G, B, and A
in the accumulation buffer.
</p></dd><dt><span class="term"><code class="constant">GL_MULT</code></span></dt><dd><p>
Multiplies each R, G, B, and A
in the accumulation buffer by <em class="parameter"><code>value</code></em> and returns the scaled component
to its corresponding accumulation buffer location.
</p></dd><dt><span class="term"><code class="constant">GL_RETURN</code></span></dt><dd><p>
Transfers accumulation buffer values
to the color buffer or buffers currently selected for writing.
Each R, G, B, and A component is multiplied by <em class="parameter"><code>value</code></em>,
then multiplied by
<math overflow="scroll">
<mrow>
<msup><mn>2</mn>
<mi mathvariant="italic">n</mi>
</msup>
<mo>-</mo>
<mn>1</mn>
</mrow>
</math>,
clamped to the range
<math overflow="scroll">
<mfenced open="[" close="]">
<mn>0</mn>
<mrow>
<msup><mn>2</mn>
<mi mathvariant="italic">n</mi>
</msup>
<mo>-</mo>
<mn>1</mn>
</mrow>
</mfenced>
</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.
</p></dd></dl></div><p>
To clear the accumulation buffer, call <a class="citerefentry" href="glClearAccum"><span class="citerefentry"><span class="refentrytitle">glClearAccum</span></span></a> with R, G, B,
and A values to set it to, then call <a class="citerefentry" href="glClear"><span class="citerefentry"><span class="refentrytitle">glClear</span></span></a> with the
accumulation buffer enabled.
</p></div><div class="refsect1" lang="en" xml:lang="en"><a id="notes"></a><h2>Notes</h2><p>
Only pixels within the current scissor box are updated by a
<code class="function">glAccum</code> operation.
</p></div><div class="refsect1" lang="en" xml:lang="en"><a id="errors"></a><h2>Errors</h2><p>
<code class="constant">GL_INVALID_ENUM</code> is generated if <em class="parameter"><code>op</code></em> is not an accepted value.
</p><p>
<code class="constant">GL_INVALID_OPERATION</code> is generated if there is no accumulation buffer.
</p><p>
<code class="constant">GL_INVALID_OPERATION</code> is generated if <code class="function">glAccum</code>
is executed between the execution of
<a class="citerefentry" href="glBegin"><span class="citerefentry"><span class="refentrytitle">glBegin</span></span></a> and the corresponding execution of <a class="citerefentry" href="glEnd"><span class="citerefentry"><span class="refentrytitle">glEnd</span></span></a>.
</p></div><div class="refsect1" lang="en" xml:lang="en"><a id="associatedgets"></a><h2>Associated Gets</h2><p>
<a class="citerefentry" href="glGet"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_ACCUM_RED_BITS</code>
</p><p>
<a class="citerefentry" href="glGet"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_ACCUM_GREEN_BITS</code>
</p><p>
<a class="citerefentry" href="glGet"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_ACCUM_BLUE_BITS</code>
</p><p>
<a class="citerefentry" href="glGet"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_ACCUM_ALPHA_BITS</code>
</p></div>
{$pipelinestall}{$examples}
<div class="refsect1" lang="en" xml:lang="en"><a id="seealso"></a><h2>See Also</h2><p>
<a class="citerefentry" href="glClear"><span class="citerefentry"><span class="refentrytitle">glClear</span></span></a>,
<a class="citerefentry" href="glClearAccum"><span class="citerefentry"><span class="refentrytitle">glClearAccum</span></span></a>,
<a class="citerefentry" href="glCopyPixels"><span class="citerefentry"><span class="refentrytitle">glCopyPixels</span></span></a>,
<a class="citerefentry" href="glDrawBuffer"><span class="citerefentry"><span class="refentrytitle">glDrawBuffer</span></span></a>,
<a class="citerefentry" href="glGet"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a>,
<a class="citerefentry" href="glReadBuffer"><span class="citerefentry"><span class="refentrytitle">glReadBuffer</span></span></a>,
<a class="citerefentry" href="glReadPixels"><span class="citerefentry"><span class="refentrytitle">glReadPixels</span></span></a>,
<a class="citerefentry" href="glScissor"><span class="citerefentry"><span class="refentrytitle">glScissor</span></span></a>,
<a class="citerefentry" href="glStencilOp"><span class="citerefentry"><span class="refentrytitle">glStencilOp</span></span></a>
</p></div><div class="refsect1" lang="en" xml:lang="en"><div id="Copyright"><h2>Copyright</h2><p>
Copyright © 1991-2006
Silicon Graphics, Inc. This document is licensed under the SGI
Free Software B License. For details, see
<a class="ulink" href="https://web.archive.org/web/20171022161616/http://oss.sgi.com/projects/FreeB/" target="_top">https://web.archive.org/web/20171022161616/http://oss.sgi.com/projects/FreeB/</a>.
</p></div></div></div>