-
Notifications
You must be signed in to change notification settings - Fork 94
/
glFeedbackBuffer.xhtml
280 lines (277 loc) · 19.7 KB
/
glFeedbackBuffer.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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
<div class="refentry" lang="en" xml:lang="en"><a id="glFeedbackBuffer"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>glFeedbackBuffer — controls feedback mode</p></div><div class="refsynopsisdiv"><h2>C Specification</h2><div class="funcsynopsis"><table><tr><td><code class="funcdef">void <b class="fsfunc">glFeedbackBuffer</b>(</code></td><td>GLsizei </td><td><var class="pdparam">size</var>, </td></tr><tr><td> </td><td>GLenum </td><td><var class="pdparam">type</var>, </td></tr><tr><td> </td><td>GLfloat * </td><td><var class="pdparam">buffer</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>size</code></em></span></dt><dd><p>
Specifies the maximum number of values that can be written into <em class="parameter"><code>buffer</code></em>.
</p></dd><dt><span class="term"><em class="parameter"><code>type</code></em></span></dt><dd><p>
Specifies a symbolic constant that describes the information
that will be returned for each vertex.
<code class="constant">GL_2D</code>,
<code class="constant">GL_3D</code>,
<code class="constant">GL_3D_COLOR</code>,
<code class="constant">GL_3D_COLOR_TEXTURE</code>, and
<code class="constant">GL_4D_COLOR_TEXTURE</code> are accepted.
</p></dd><dt><span class="term"><em class="parameter"><code>buffer</code></em></span></dt><dd><p>
Returns the feedback data.
</p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><h2>Description</h2><p>
The <code class="function">glFeedbackBuffer</code> function controls feedback.
Feedback, like selection, is a GL mode.
The mode is selected by calling
<a class="citerefentry" href="glRenderMode"><span class="citerefentry"><span class="refentrytitle">glRenderMode</span></span></a> with <code class="constant">GL_FEEDBACK</code>.
When the GL is in feedback mode,
no pixels are produced by rasterization.
Instead, information about primitives that would have been
rasterized is fed back to the application using the GL.
</p><p>
<code class="function">glFeedbackBuffer</code> has three arguments:
<em class="parameter"><code>buffer</code></em> is a pointer to an array of floating-point values
into which feedback information is placed.
<em class="parameter"><code>size</code></em> indicates the size of the array.
<em class="parameter"><code>type</code></em> is a symbolic constant describing the information
that is fed back for each vertex.
<code class="function">glFeedbackBuffer</code> must be issued before feedback mode is enabled
(by calling <a class="citerefentry" href="glRenderMode"><span class="citerefentry"><span class="refentrytitle">glRenderMode</span></span></a> with argument <code class="constant">GL_FEEDBACK</code>).
Setting <code class="constant">GL_FEEDBACK</code> without establishing the feedback buffer,
or calling <code class="function">glFeedbackBuffer</code> while the GL is in feedback mode,
is an error.
</p><p>
When <a class="citerefentry" href="glRenderMode"><span class="citerefentry"><span class="refentrytitle">glRenderMode</span></span></a> is called while in feedback mode, it returns the number of entries
placed in the feedback array and resets the feedback array pointer to the base
of the feedback buffer. The returned value never exceeds <em class="parameter"><code>size</code></em>. If the feedback
data required more room than was available in <em class="parameter"><code>buffer</code></em>,
<a class="citerefentry" href="glRenderMode"><span class="citerefentry"><span class="refentrytitle">glRenderMode</span></span></a> returns a negative value.
To take the GL out of feedback mode, call
<a class="citerefentry" href="glRenderMode"><span class="citerefentry"><span class="refentrytitle">glRenderMode</span></span></a> with a parameter value other than <code class="constant">GL_FEEDBACK</code>.
</p><p>
While in feedback mode,
each primitive, bitmap, or pixel rectangle that would be rasterized
generates a block of values that are copied into the feedback array.
If doing so would cause the number of entries to exceed the maximum,
the block is partially written so as to fill the array
(if there is any room left at all),
and an overflow flag is set.
Each block begins with a code indicating the primitive type,
followed by values that describe the primitive's vertices and
associated data.
Entries are also written for bitmaps and pixel rectangles.
Feedback occurs after polygon culling and <a class="citerefentry" href="glPolygonMode"><span class="citerefentry"><span class="refentrytitle">glPolygonMode</span></span></a> interpretation
of polygons has taken place,
so polygons that are culled are not returned in the feedback buffer.
It can also occur after polygons with more than three edges are broken up
into triangles,
if the GL implementation renders polygons by performing this decomposition.
</p><p>
The <a class="citerefentry" href="glPassThrough"><span class="citerefentry"><span class="refentrytitle">glPassThrough</span></span></a> command can be used to insert a marker
into the feedback buffer.
See <a class="citerefentry" href="glPassThrough"><span class="citerefentry"><span class="refentrytitle">glPassThrough</span></span></a>.
</p><p>
Following is the grammar for the blocks of values written
into the feedback buffer.
Each primitive is indicated with a unique identifying value
followed by some number of vertices.
Polygon entries include an integer value indicating how many vertices follow.
A vertex is fed back as some number of floating-point values,
as determined by <em class="parameter"><code>type</code></em>.
Colors are fed back as four values in RGBA mode and one value
in color index mode.
</p><p>
</p><p>
feedbackList <math overflow="scroll"><mrow><mn>←</mn></mrow></math> feedbackItem feedbackList | feedbackItem
</p><p>
</p><p>
feedbackItem <math overflow="scroll"><mrow><mn>←</mn></mrow></math> point | lineSegment | polygon | bitmap | pixelRectangle | passThru
</p><p>
</p><p>
point <math overflow="scroll"><mrow><mn>←</mn></mrow></math> <code class="constant">GL_POINT_TOKEN</code> vertex
</p><p>
</p><p>
lineSegment <math overflow="scroll"><mrow><mn>←</mn></mrow></math> <code class="constant">GL_LINE_TOKEN</code> vertex vertex | <code class="constant">GL_LINE_RESET_TOKEN</code> vertex vertex
</p><p>
</p><p>
polygon <math overflow="scroll"><mrow><mn>←</mn></mrow></math> <code class="constant">GL_POLYGON_TOKEN</code> n polySpec
</p><p>
</p><p>
polySpec <math overflow="scroll"><mrow><mn>←</mn></mrow></math> polySpec vertex | vertex vertex vertex
</p><p>
</p><p>
bitmap <math overflow="scroll"><mrow><mn>←</mn></mrow></math> <code class="constant">GL_BITMAP_TOKEN</code> vertex
</p><p>
</p><p>
pixelRectangle <math overflow="scroll"><mrow><mn>←</mn></mrow></math> <code class="constant">GL_DRAW_PIXEL_TOKEN</code> vertex | <code class="constant">GL_COPY_PIXEL_TOKEN</code> vertex
</p><p>
</p><p>
passThru <math overflow="scroll"><mrow><mn>←</mn></mrow></math> <code class="constant">GL_PASS_THROUGH_TOKEN</code> value
</p><p>
</p><p>
vertex <math overflow="scroll"><mrow><mn>←</mn></mrow></math> 2d | 3d | 3dColor | 3dColorTexture | 4dColorTexture
</p><p>
</p><p>
2d <math overflow="scroll"><mrow><mn>←</mn></mrow></math> value value
</p><p>
</p><p>
3d <math overflow="scroll"><mrow><mn>←</mn></mrow></math> value value value
</p><p>
</p><p>
3dColor <math overflow="scroll"><mrow><mn>←</mn></mrow></math> value value value color
</p><p>
</p><p>
3dColorTexture <math overflow="scroll"><mrow><mn>←</mn></mrow></math> value value value color tex
</p><p>
</p><p>
4dColorTexture <math overflow="scroll"><mrow><mn>←</mn></mrow></math> value value value value color tex
</p><p>
</p><p>
color <math overflow="scroll"><mrow><mn>←</mn></mrow></math> rgba | index
</p><p>
</p><p>
rgba <math overflow="scroll"><mrow><mn>←</mn></mrow></math> value value value value
</p><p>
</p><p>
index <math overflow="scroll"><mrow><mn>←</mn></mrow></math> value
</p><p>
</p><p>
tex <math overflow="scroll"><mrow><mn>←</mn></mrow></math> value value value value
</p><p>
</p><p>
</p><p>
</p><p>
<span class="emphasis"><em>value</em></span>
is a floating-point number,
and
<span class="emphasis"><em>n</em></span>
is a floating-point integer giving the number of vertices in the polygon.
<code class="constant">GL_POINT_TOKEN</code>,
<code class="constant">GL_LINE_TOKEN</code>,
<code class="constant">GL_LINE_RESET_TOKEN</code>,
<code class="constant">GL_POLYGON_TOKEN</code>,
<code class="constant">GL_BITMAP_TOKEN</code>,
<code class="constant">GL_DRAW_PIXEL_TOKEN</code>,
<code class="constant">GL_COPY_PIXEL_TOKEN</code> and
<code class="constant">GL_PASS_THROUGH_TOKEN</code> are symbolic floating-point constants.
<code class="constant">GL_LINE_RESET_TOKEN</code> is returned whenever the line stipple pattern
is reset.
The data returned as a vertex depends on the feedback <em class="parameter"><code>type</code></em>.
</p><p>
The following table gives the correspondence between <em class="parameter"><code>type</code></em>
and the number of values per vertex.
<span class="emphasis"><em>k</em></span> is 1 in color index mode and 4 in RGBA mode.
</p><p>
</p><div class="informaltable"><table><colgroup><col /><col /><col /><col /><col /></colgroup><thead><tr><th><span class="bold"><strong>
Type
</strong></span></th><th><span class="bold"><strong>
Coordinates
</strong></span></th><th class="center"><span class="bold"><strong>
Color
</strong></span></th><th class="center"><span class="bold"><strong>
Texture
</strong></span></th><th class="center"><span class="bold"><strong>
Total Number of Values
</strong></span></th></tr></thead><tbody><tr><td>
<code class="constant">GL_2D</code>
</td><td>
<span class="emphasis"><em>x</em></span>, <span class="emphasis"><em>y</em></span>
</td><td class="center">
</td><td class="center">
</td><td class="center">
2
</td></tr><tr><td>
<code class="constant">GL_3D</code>
</td><td>
<span class="emphasis"><em>x</em></span>, <span class="emphasis"><em>y</em></span>, <span class="emphasis"><em>z</em></span>
</td><td class="center">
</td><td class="center">
</td><td class="center">
3
</td></tr><tr><td>
<code class="constant">GL_3D_COLOR</code>
</td><td>
<span class="emphasis"><em>x</em></span>, <span class="emphasis"><em>y</em></span>, <span class="emphasis"><em>z</em></span>
</td><td class="center">
<math overflow="scroll"><mi mathvariant="italic">k</mi></math>
</td><td class="center">
</td><td class="center">
<math overflow="scroll">
<mrow>
<mn>3</mn>
<mo>+</mo>
<mi mathvariant="italic">k</mi>
</mrow>
</math>
</td></tr><tr><td>
<code class="constant">GL_3D_COLOR_TEXTURE</code>
</td><td>
<span class="emphasis"><em>x</em></span>, <span class="emphasis"><em>y</em></span>, <span class="emphasis"><em>z</em></span>
</td><td class="center">
<math overflow="scroll"><mi mathvariant="italic">k</mi></math>
</td><td class="center">
4
</td><td class="center">
<math overflow="scroll">
<mrow>
<mn>7</mn>
<mo>+</mo>
<mi mathvariant="italic">k</mi>
</mrow>
</math>
</td></tr><tr><td>
<code class="constant">GL_4D_COLOR_TEXTURE</code>
</td><td>
<span class="emphasis"><em>x</em></span>, <span class="emphasis"><em>y</em></span>, <span class="emphasis"><em>z</em></span>, <span class="emphasis"><em>w</em></span>
</td><td class="center">
<math overflow="scroll"><mi mathvariant="italic">k</mi></math>
</td><td class="center">
4
</td><td class="center">
<math overflow="scroll">
<mrow>
<mn>8</mn>
<mo>+</mo>
<mi mathvariant="italic">k</mi>
</mrow>
</math>
</td></tr></tbody></table></div><p>
Feedback vertex coordinates are in window coordinates,
except <span class="emphasis"><em>w</em></span>,
which is in clip coordinates.
Feedback colors are lighted, if lighting is enabled.
Feedback texture coordinates are generated,
if texture coordinate generation is enabled.
They are always transformed by the texture matrix.
</p></div><div class="refsect1" lang="en" xml:lang="en"><a id="notes"></a><h2>Notes</h2><p>
<code class="function">glFeedbackBuffer</code>, when used in a display list, is not compiled into the display list
but is executed immediately.
</p><p>
<code class="function">glFeedbackBuffer</code> returns only the texture coordinate of texture unit <code class="constant">GL_TEXTURE0</code>.
</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>type</code></em> is not an accepted value.
</p><p>
<code class="constant">GL_INVALID_VALUE</code> is generated if <em class="parameter"><code>size</code></em> is negative.
</p><p>
<code class="constant">GL_INVALID_OPERATION</code> is generated if <code class="function">glFeedbackBuffer</code> is called while the
render mode is <code class="constant">GL_FEEDBACK</code>,
or if <a class="citerefentry" href="glRenderMode"><span class="citerefentry"><span class="refentrytitle">glRenderMode</span></span></a> is called with argument <code class="constant">GL_FEEDBACK</code> before
<code class="function">glFeedbackBuffer</code> is called at least once.
</p><p>
<code class="constant">GL_INVALID_OPERATION</code> is generated if <code class="function">glFeedbackBuffer</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_RENDER_MODE</code>
</p><p>
<a class="citerefentry" href="glGet"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_FEEDBACK_BUFFER_POINTER</code>
</p><p>
<a class="citerefentry" href="glGet"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_FEEDBACK_BUFFER_SIZE</code>
</p><p>
<a class="citerefentry" href="glGet"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_FEEDBACK_BUFFER_TYPE</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="glBegin"><span class="citerefentry"><span class="refentrytitle">glBegin</span></span></a>,
<a class="citerefentry" href="glLineStipple"><span class="citerefentry"><span class="refentrytitle">glLineStipple</span></span></a>,
<a class="citerefentry" href="glPassThrough"><span class="citerefentry"><span class="refentrytitle">glPassThrough</span></span></a>,
<a class="citerefentry" href="glPolygonMode"><span class="citerefentry"><span class="refentrytitle">glPolygonMode</span></span></a>,
<a class="citerefentry" href="glRenderMode"><span class="citerefentry"><span class="refentrytitle">glRenderMode</span></span></a>,
<a class="citerefentry" href="glSelectBuffer"><span class="citerefentry"><span class="refentrytitle">glSelectBuffer</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>