Subversion Repositories AndroidProjects

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1452 chris 1
<?xml version="1.0" encoding="UTF-8"?>
2
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook MathML Module V1.1b1//EN"
3
              "http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd">
4
<refentry id="glSeparableFilter2D">
5
    <refmeta>
6
        <refmetainfo>
7
            <copyright>
8
                <year>1991-2006</year>
9
                <holder>Silicon Graphics, Inc.</holder>
10
            </copyright>
11
        </refmetainfo>
12
        <refentrytitle>glSeparableFilter2D</refentrytitle>
13
        <manvolnum>3G</manvolnum>
14
    </refmeta>
15
    <refnamediv>
16
        <refname>glSeparableFilter2D</refname>
17
        <refpurpose>define a separable two-dimensional convolution filter</refpurpose>
18
    </refnamediv>
19
    <refsynopsisdiv><title>C Specification</title>
20
        <funcsynopsis>
21
            <funcprototype>
22
                <funcdef>void <function>glSeparableFilter2D</function></funcdef>
23
                <paramdef>GLenum <parameter>target</parameter></paramdef>
24
                <paramdef>GLenum <parameter>internalformat</parameter></paramdef>
25
                <paramdef>GLsizei <parameter>width</parameter></paramdef>
26
                <paramdef>GLsizei <parameter>height</parameter></paramdef>
27
                <paramdef>GLenum <parameter>format</parameter></paramdef>
28
                <paramdef>GLenum <parameter>type</parameter></paramdef>
29
                <paramdef>const GLvoid * <parameter>row</parameter></paramdef>
30
                <paramdef>const GLvoid * <parameter>column</parameter></paramdef>
31
            </funcprototype>
32
        </funcsynopsis>
33
    </refsynopsisdiv>
34
    <refsect1 id="parameters"><title>Parameters</title>
35
        <variablelist>
36
        <varlistentry>
37
            <term><parameter>target</parameter></term>
38
            <listitem>
39
                <para>
40
                    Must be <constant>GL_SEPARABLE_2D</constant>.
41
                </para>
42
            </listitem>
43
        </varlistentry>
44
        <varlistentry>
45
            <term><parameter>internalformat</parameter></term>
46
            <listitem>
47
                <para>
48
                    The internal format of the convolution filter kernel.
49
                    The allowable values are
50
                    <constant>GL_ALPHA</constant>,
51
                    <constant>GL_ALPHA4</constant>,
52
                    <constant>GL_ALPHA8</constant>,
53
                    <constant>GL_ALPHA12</constant>,
54
                    <constant>GL_ALPHA16</constant>,
55
                    <constant>GL_LUMINANCE</constant>,
56
                    <constant>GL_LUMINANCE4</constant>,
57
                    <constant>GL_LUMINANCE8</constant>,
58
                    <constant>GL_LUMINANCE12</constant>,
59
                    <constant>GL_LUMINANCE16</constant>,
60
                    <constant>GL_LUMINANCE_ALPHA</constant>,
61
                    <constant>GL_LUMINANCE4_ALPHA4</constant>,
62
                    <constant>GL_LUMINANCE6_ALPHA2</constant>,
63
                    <constant>GL_LUMINANCE8_ALPHA8</constant>,
64
                    <constant>GL_LUMINANCE12_ALPHA4</constant>,
65
                    <constant>GL_LUMINANCE12_ALPHA12</constant>,
66
                    <constant>GL_LUMINANCE16_ALPHA16</constant>,
67
                    <constant>GL_INTENSITY</constant>,
68
                    <constant>GL_INTENSITY4</constant>,
69
                    <constant>GL_INTENSITY8</constant>,
70
                    <constant>GL_INTENSITY12</constant>,
71
                    <constant>GL_INTENSITY16</constant>,
72
                    <constant>GL_R3_G3_B2</constant>,
73
                    <constant>GL_RGB</constant>,
74
                    <constant>GL_RGB4</constant>,
75
                    <constant>GL_RGB5</constant>,
76
                    <constant>GL_RGB8</constant>,
77
                    <constant>GL_RGB10</constant>,
78
                    <constant>GL_RGB12</constant>,
79
                    <constant>GL_RGB16</constant>,
80
                    <constant>GL_RGBA</constant>,
81
                    <constant>GL_RGBA2</constant>,
82
                    <constant>GL_RGBA4</constant>,
83
                    <constant>GL_RGB5_A1</constant>,
84
                    <constant>GL_RGBA8</constant>,
85
                    <constant>GL_RGB10_A2</constant>,
86
                    <constant>GL_RGBA12</constant>, or
87
                    <constant>GL_RGBA16</constant>.
88
                </para>
89
            </listitem>
90
        </varlistentry>
91
        <varlistentry>
92
            <term><parameter>width</parameter></term>
93
            <listitem>
94
                <para>
95
                    The number of elements in the pixel array referenced by <parameter>row</parameter>.
96
                    (This is the width of the separable filter kernel.)
97
                </para>
98
            </listitem>
99
        </varlistentry>
100
        <varlistentry>
101
            <term><parameter>height</parameter></term>
102
            <listitem>
103
                <para>
104
                    The number of elements in the pixel array referenced by <parameter>column</parameter>.
105
                    (This is the height of the separable filter kernel.)
106
                </para>
107
            </listitem>
108
        </varlistentry>
109
        <varlistentry>
110
            <term><parameter>format</parameter></term>
111
            <listitem>
112
                <para>
113
                    The format of the pixel data in <parameter>row</parameter> and <parameter>column</parameter>.
114
                    The allowable values are
115
                    <constant>GL_RED</constant>,
116
                    <constant>GL_GREEN</constant>,
117
                    <constant>GL_BLUE</constant>,
118
                    <constant>GL_ALPHA</constant>,
119
                    <constant>GL_RGB</constant>,
120
                    <constant>GL_BGR</constant>,
121
                    <constant>GL_RGBA</constant>,
122
                    <constant>GL_BGRA</constant>,
123
                    <constant>GL_INTENSITY</constant>,
124
                    <constant>GL_LUMINANCE</constant>, and
125
                    <constant>GL_LUMINANCE_ALPHA</constant>.
126
                </para>
127
            </listitem>
128
        </varlistentry>
129
        <varlistentry>
130
            <term><parameter>type</parameter></term>
131
            <listitem>
132
                <para>
133
                    The type of the pixel data in <parameter>row</parameter> and <parameter>column</parameter>.
134
                    Symbolic constants
135
                    <constant>GL_UNSIGNED_BYTE</constant>,
136
                    <constant>GL_BYTE</constant>,
137
                    <constant>GL_BITMAP</constant>,
138
                    <constant>GL_UNSIGNED_SHORT</constant>,
139
                    <constant>GL_SHORT</constant>,
140
                    <constant>GL_UNSIGNED_INT</constant>,
141
                    <constant>GL_INT</constant>,
142
                    <constant>GL_FLOAT</constant>,
143
                    <constant>GL_UNSIGNED_BYTE_3_3_2</constant>,
144
                    <constant>GL_UNSIGNED_BYTE_2_3_3_REV</constant>,
145
                    <constant>GL_UNSIGNED_SHORT_5_6_5</constant>,
146
                    <constant>GL_UNSIGNED_SHORT_5_6_5_REV</constant>,
147
                    <constant>GL_UNSIGNED_SHORT_4_4_4_4</constant>,
148
                    <constant>GL_UNSIGNED_SHORT_4_4_4_4_REV</constant>,
149
                    <constant>GL_UNSIGNED_SHORT_5_5_5_1</constant>,
150
                    <constant>GL_UNSIGNED_SHORT_1_5_5_5_REV</constant>,
151
                    <constant>GL_UNSIGNED_INT_8_8_8_8</constant>,
152
                    <constant>GL_UNSIGNED_INT_8_8_8_8_REV</constant>,
153
                    <constant>GL_UNSIGNED_INT_10_10_10_2</constant>, and
154
                    <constant>GL_UNSIGNED_INT_2_10_10_10_REV</constant>
155
                    are accepted.
156
                </para>
157
            </listitem>
158
        </varlistentry>
159
        <varlistentry>
160
            <term><parameter>row</parameter></term>
161
            <listitem>
162
                <para>
163
                    Pointer to a one-dimensional array of pixel data that is processed to
164
                    build the row filter kernel.
165
                </para>
166
            </listitem>
167
        </varlistentry>
168
        <varlistentry>
169
            <term><parameter>column</parameter></term>
170
            <listitem>
171
                <para>
172
                    Pointer to a one-dimensional array of pixel data that is processed to
173
                    build the column filter kernel.
174
                </para>
175
            </listitem>
176
        </varlistentry>
177
        </variablelist>
178
    </refsect1>
179
    <refsect1 id="description"><title>Description</title>
180
        <para>
181
            <function>glSeparableFilter2D</function> builds a two-dimensional separable convolution filter kernel from
182
            two arrays of pixels.
183
        </para>
184
        <para>
185
            The pixel arrays specified by (<parameter>width</parameter>, <parameter>format</parameter>, <parameter>type</parameter>, <parameter>row</parameter>)
186
            and (<parameter>height</parameter>, <parameter>format</parameter>, <parameter>type</parameter>, <parameter>column</parameter>) are processed just as if
187
            they had been passed to <citerefentry><refentrytitle>glDrawPixels</refentrytitle></citerefentry>,
188
            but processing stops after the final expansion to RGBA is completed.
189
        </para>
190
        <para>
191
            If a non-zero named buffer object is bound to the <constant>GL_PIXEL_UNPACK_BUFFER</constant> target
192
            (see <citerefentry><refentrytitle>glBindBuffer</refentrytitle></citerefentry>) while a convolution filter is
193
            specified, <parameter>row</parameter> and <parameter>column</parameter> are treated as byte offsets into the buffer object's data store.
194
        </para>
195
        <para>
196
            Next, the R, G, B, and A components of all pixels in both arrays are scaled
197
            by the four separable 2D <constant>GL_CONVOLUTION_FILTER_SCALE</constant> parameters and
198
            biased by the four separable 2D <constant>GL_CONVOLUTION_FILTER_BIAS</constant> parameters.
199
            (The scale and bias parameters are set by <citerefentry><refentrytitle>glConvolutionParameter</refentrytitle></citerefentry>
200
            using the <constant>GL_SEPARABLE_2D</constant> target and the names
201
            <constant>GL_CONVOLUTION_FILTER_SCALE</constant> and <constant>GL_CONVOLUTION_FILTER_BIAS</constant>.
202
            The parameters themselves are vectors of four values that are applied to red,
203
            green, blue, and alpha, in that order.)
204
            The R, G, B, and A values are not clamped to [0,1] at any time during this
205
            process.
206
        </para>
207
        <para>
208
            Each pixel is then converted to the internal format specified by
209
            <parameter>internalformat</parameter>.
210
            This conversion simply maps the component values of the pixel (R, G, B,
211
            and A) to the values included in the internal format (red, green, blue,
212
            alpha, luminance, and intensity).  The mapping is as follows:
213
        </para>
214
        <informaltable frame="topbot">
215
            <tgroup cols="7" align="left">
216
                <colspec colwidth="2.5*" />
217
                <colspec colwidth="1*" align="center"/>
218
                <colspec colwidth="1*"  align="center"/>
219
                <colspec colwidth="1*"  align="center"/>
220
                <colspec colwidth="1*"  align="center"/>
221
                <colspec colwidth="1.5*"  align="center"/>
222
                <colspec colwidth="1.5*"  align="center"/>
223
                <thead>
224
                    <row>
225
                        <entry rowsep="1" align="left"><emphasis role="bold">
226
                        Internal Format
227
                        </emphasis></entry>
228
                        <entry rowsep="1" align="center"><emphasis role="bold">
229
                        Red
230
                        </emphasis></entry>
231
                        <entry rowsep="1" align="center"><emphasis role="bold">
232
                        Green
233
                        </emphasis></entry>
234
                        <entry rowsep="1" align="center"><emphasis role="bold">
235
                        Blue
236
                        </emphasis></entry>
237
                        <entry rowsep="1" align="center"><emphasis role="bold">
238
                        Alpha
239
                        </emphasis></entry>
240
                        <entry rowsep="1" align="center"><emphasis role="bold">
241
                        Luminance
242
                        </emphasis></entry>
243
                        <entry rowsep="1" align="center"><emphasis role="bold">
244
                        Intensity
245
                        </emphasis></entry>
246
                    </row>
247
                </thead>
248
                <tbody>
249
                    <row>
250
                        <entry align="left">
251
                        <constant>GL_LUMINANCE</constant>
252
                        </entry>
253
                        <entry align="center">
254
                        </entry>
255
                        <entry align="center">
256
                        </entry>
257
                        <entry align="center">
258
                        </entry>
259
                        <entry align="center">
260
                        </entry>
261
                        <entry align="center">
262
                        R
263
                        </entry>
264
                        <entry align="center">
265
 
266
                        </entry>
267
                    </row>
268
                    <row>
269
                        <entry align="left">
270
                        <constant>GL_LUMINANCE_ALPHA</constant>
271
                        </entry>
272
                        <entry align="center">
273
                        </entry>
274
                        <entry align="center">
275
                        </entry>
276
                        <entry align="center">
277
                        </entry>
278
                        <entry align="center">
279
                        A
280
                        </entry>
281
                        <entry align="center">
282
                        R
283
                        </entry>
284
                        <entry align="center">
285
 
286
                        </entry>
287
                    </row>
288
                    <row>
289
                        <entry align="left">
290
                        <constant>GL_INTENSITY</constant>
291
                        </entry>
292
                        <entry align="center">
293
                        </entry>
294
                        <entry align="center">
295
                        </entry>
296
                        <entry align="center">
297
                        </entry>
298
                        <entry align="center">
299
                        </entry>
300
                        <entry align="center">
301
                        </entry>
302
                        <entry align="center">
303
                        R
304
                        </entry>
305
                    </row>
306
                    <row>
307
                        <entry align="left">
308
                        <constant>GL_RGB</constant>
309
                        </entry>
310
                        <entry align="center">
311
                        R
312
                        </entry>
313
                        <entry align="center">
314
                        G
315
                        </entry>
316
                        <entry align="center">
317
                        B
318
                        </entry>
319
                        <entry align="center">
320
                        </entry>
321
                        <entry align="center">
322
                        </entry>
323
                        <entry align="center">
324
 
325
                        </entry>
326
                    </row>
327
                    <row>
328
                        <entry align="left">
329
                        <constant>GL_RGBA</constant>
330
                        </entry>
331
                        <entry align="center">
332
                        R
333
                        </entry>
334
                        <entry align="center">
335
                        G
336
                        </entry>
337
                        <entry align="center">
338
                        B
339
                        </entry>
340
                        <entry align="center">
341
                        A
342
                        </entry>
343
                        <entry align="center">
344
                        </entry>
345
                        <entry align="center">
346
 
347
                        </entry>
348
                    </row>
349
                </tbody>
350
            </tgroup>
351
        </informaltable>
352
        <para>
353
            The red, green, blue, alpha, luminance, and/or intensity components of
354
            the resulting pixels are stored in floating-point rather than integer
355
            format.
356
            They form two one-dimensional filter kernel images.
357
            The row image is indexed by coordinate <emphasis>i</emphasis> starting at zero and
358
            increasing from left to right.
359
            Each location in the row image is derived from element <emphasis>i</emphasis> of <parameter>row</parameter>.
360
            The column image is indexed by coordinate <emphasis>j</emphasis> starting at zero
361
            and increasing from bottom to top.
362
            Each location in the column image is derived from element <emphasis>j</emphasis> of <parameter>column</parameter>.
363
        </para>
364
        <para>
365
            Note that after a convolution is performed, the resulting color
366
            components are also scaled by their corresponding
367
            <constant>GL_POST_CONVOLUTION_c_SCALE</constant> parameters and biased by their
368
            corresponding <constant>GL_POST_CONVOLUTION_c_BIAS</constant> parameters (where
369
            <emphasis>c</emphasis> takes on the values <emphasis role="bold">RED</emphasis>, <emphasis role="bold">GREEN</emphasis>, <emphasis role="bold">BLUE</emphasis>, and
370
            <emphasis role="bold">ALPHA</emphasis>).
371
            These parameters are set by <citerefentry><refentrytitle>glPixelTransfer</refentrytitle></citerefentry>.
372
        </para>
373
    </refsect1>
374
    <refsect1 id="notes"><title>Notes</title>
375
        <para>
376
            <function>glSeparableFilter2D</function> is present only if <code>ARB_imaging</code> is returned when <citerefentry><refentrytitle>glGetString</refentrytitle></citerefentry>
377
            is called with an argument of <constant>GL_EXTENSIONS</constant>.
378
        </para>
379
    </refsect1>
380
    <refsect1 id="errors"><title>Errors</title>
381
        <para>
382
            <constant>GL_INVALID_ENUM</constant> is generated if <parameter>target</parameter> is not
383
            <constant>GL_SEPARABLE_2D</constant>.
384
        </para>
385
        <para>
386
            <constant>GL_INVALID_ENUM</constant> is generated if <parameter>internalformat</parameter> is not one of the
387
            allowable values.
388
        </para>
389
        <para>
390
            <constant>GL_INVALID_ENUM</constant> is generated if <parameter>format</parameter> is not one of the allowable
391
            values.
392
        </para>
393
        <para>
394
            <constant>GL_INVALID_ENUM</constant> is generated if <parameter>type</parameter> is not one of the allowable
395
            values.
396
        </para>
397
        <para>
398
            <constant>GL_INVALID_VALUE</constant> is generated if <parameter>width</parameter> is less than zero or greater
399
            than the maximum supported value.
400
            This value may be queried with <citerefentry><refentrytitle>glGetConvolutionParameter</refentrytitle></citerefentry>
401
            using target <constant>GL_SEPARABLE_2D</constant> and name
402
            <constant>GL_MAX_CONVOLUTION_WIDTH</constant>.
403
        </para>
404
        <para>
405
            <constant>GL_INVALID_VALUE</constant> is generated if <parameter>height</parameter> is less than zero or greater
406
            than the maximum supported value.
407
            This value may be queried with <citerefentry><refentrytitle>glGetConvolutionParameter</refentrytitle></citerefentry>
408
            using target <constant>GL_SEPARABLE_2D</constant> and name
409
            <constant>GL_MAX_CONVOLUTION_HEIGHT</constant>.
410
        </para>
411
        <para>
412
            <constant>GL_INVALID_OPERATION</constant> is generated if <parameter>height</parameter> is one of
413
            <constant>GL_UNSIGNED_BYTE_3_3_2</constant>,
414
            <constant>GL_UNSIGNED_BYTE_2_3_3_REV</constant>,
415
            <constant>GL_UNSIGNED_SHORT_5_6_5</constant>, or
416
            <constant>GL_UNSIGNED_SHORT_5_6_5_REV</constant>
417
            and <parameter>format</parameter> is not <constant>GL_RGB</constant>.
418
        </para>
419
        <para>
420
            <constant>GL_INVALID_OPERATION</constant> is generated if <parameter>height</parameter> is one of
421
            <constant>GL_UNSIGNED_SHORT_4_4_4_4</constant>,
422
            <constant>GL_UNSIGNED_SHORT_4_4_4_4_REV</constant>,
423
            <constant>GL_UNSIGNED_SHORT_5_5_5_1</constant>,
424
            <constant>GL_UNSIGNED_SHORT_1_5_5_5_REV</constant>,
425
            <constant>GL_UNSIGNED_INT_8_8_8_8</constant>,
426
            <constant>GL_UNSIGNED_INT_8_8_8_8_REV</constant>,
427
            <constant>GL_UNSIGNED_INT_10_10_10_2</constant>, or
428
            <constant>GL_UNSIGNED_INT_2_10_10_10_REV</constant>
429
            and <parameter>format</parameter> is neither <constant>GL_RGBA</constant> nor <constant>GL_BGRA</constant>.
430
        </para>
431
        <para>
432
            <constant>GL_INVALID_OPERATION</constant> is generated if a non-zero buffer object name is bound to the
433
            <constant>GL_PIXEL_UNPACK_BUFFER</constant> target and the buffer object's data store is currently mapped.
434
        </para>
435
        <para>
436
            <constant>GL_INVALID_OPERATION</constant> is generated if a non-zero buffer object name is bound to the
437
            <constant>GL_PIXEL_UNPACK_BUFFER</constant> target and the data would be unpacked from the buffer
438
            object such that the memory reads required would exceed the data store size.
439
        </para>
440
        <para>
441
            <constant>GL_INVALID_OPERATION</constant> is generated if a non-zero buffer object name is bound to the
442
            <constant>GL_PIXEL_UNPACK_BUFFER</constant> target and <parameter>row</parameter> or
443
            <parameter>column</parameter> is not evenly divisible
444
            into the number of bytes needed to store in memory a datum indicated by <parameter>type</parameter>.
445
        </para>
446
        <para>
447
            <constant>GL_INVALID_OPERATION</constant> is generated if <function>glSeparableFilter2D</function> is executed
448
            between the execution of <citerefentry><refentrytitle>glBegin</refentrytitle></citerefentry> and the corresponding
449
            execution of <citerefentry><refentrytitle>glEnd</refentrytitle></citerefentry>.
450
        </para>
451
    </refsect1>
452
    <refsect1 id="associatedgets"><title>Associated Gets</title>
453
        <para>
454
            <citerefentry><refentrytitle>glGetConvolutionParameter</refentrytitle></citerefentry>, <citerefentry><refentrytitle>glGetSeparableFilter</refentrytitle></citerefentry>
455
        </para>
456
        <para>
457
            <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_PIXEL_UNPACK_BUFFER_BINDING</constant>
458
        </para>
459
    </refsect1>
460
    <refsect1 id="seealso"><title>See Also</title>
461
        <para>
462
            <citerefentry><refentrytitle>glConvolutionFilter1D</refentrytitle></citerefentry>,
463
            <citerefentry><refentrytitle>glConvolutionFilter2D</refentrytitle></citerefentry>,
464
            <citerefentry><refentrytitle>glConvolutionParameter</refentrytitle></citerefentry>,
465
            <citerefentry><refentrytitle>glPixelTransfer</refentrytitle></citerefentry>
466
        </para>
467
    </refsect1>
468
    <refsect1 id="Copyright"><title>Copyright</title>
469
        <para>
470
            Copyright <trademark class="copyright"></trademark> 1991-2006
471
            Silicon Graphics, Inc. This document is licensed under the SGI
472
            Free Software B License. For details, see
473
            <ulink url="http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/</ulink>.
474
        </para>
475
    </refsect1>
476
</refentry>