Commit | Line | Data |
---|---|---|
7faf1d71 AW |
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="glCopyConvolutionFilter2D"> | |
5 | <refmeta> | |
6 | <refmetainfo> | |
7 | <copyright> | |
8 | <year>1991-2006</year> | |
9 | <holder>Silicon Graphics, Inc.</holder> | |
10 | </copyright> | |
11 | </refmetainfo> | |
12 | <refentrytitle>glCopyConvolutionFilter2D</refentrytitle> | |
13 | <manvolnum>3G</manvolnum> | |
14 | </refmeta> | |
15 | <refnamediv> | |
16 | <refname>glCopyConvolutionFilter2D</refname> | |
17 | <refpurpose>copy pixels into a two-dimensional convolution filter</refpurpose> | |
18 | </refnamediv> | |
19 | <refsynopsisdiv><title>C Specification</title> | |
20 | <funcsynopsis> | |
21 | <funcprototype> | |
22 | <funcdef>void <function>glCopyConvolutionFilter2D</function></funcdef> | |
23 | <paramdef>GLenum <parameter>target</parameter></paramdef> | |
24 | <paramdef>GLenum <parameter>internalformat</parameter></paramdef> | |
25 | <paramdef>GLint <parameter>x</parameter></paramdef> | |
26 | <paramdef>GLint <parameter>y</parameter></paramdef> | |
27 | <paramdef>GLsizei <parameter>width</parameter></paramdef> | |
28 | <paramdef>GLsizei <parameter>height</parameter></paramdef> | |
29 | </funcprototype> | |
30 | </funcsynopsis> | |
31 | </refsynopsisdiv> | |
32 | <refsect1 id="parameters"><title>Parameters</title> | |
33 | <variablelist> | |
34 | <varlistentry> | |
35 | <term><parameter>target</parameter></term> | |
36 | <listitem> | |
37 | <para> | |
38 | Must be <constant>GL_CONVOLUTION_2D</constant>. | |
39 | </para> | |
40 | </listitem> | |
41 | </varlistentry> | |
42 | <varlistentry> | |
43 | <term><parameter>internalformat</parameter></term> | |
44 | <listitem> | |
45 | <para> | |
46 | The internal format of the convolution filter kernel. | |
47 | The allowable values are | |
48 | <constant>GL_ALPHA</constant>, | |
49 | <constant>GL_ALPHA4</constant>, | |
50 | <constant>GL_ALPHA8</constant>, | |
51 | <constant>GL_ALPHA12</constant>, | |
52 | <constant>GL_ALPHA16</constant>, | |
53 | <constant>GL_LUMINANCE</constant>, | |
54 | <constant>GL_LUMINANCE4</constant>, | |
55 | <constant>GL_LUMINANCE8</constant>, | |
56 | <constant>GL_LUMINANCE12</constant>, | |
57 | <constant>GL_LUMINANCE16</constant>, | |
58 | <constant>GL_LUMINANCE_ALPHA</constant>, | |
59 | <constant>GL_LUMINANCE4_ALPHA4</constant>, | |
60 | <constant>GL_LUMINANCE6_ALPHA2</constant>, | |
61 | <constant>GL_LUMINANCE8_ALPHA8</constant>, | |
62 | <constant>GL_LUMINANCE12_ALPHA4</constant>, | |
63 | <constant>GL_LUMINANCE12_ALPHA12</constant>, | |
64 | <constant>GL_LUMINANCE16_ALPHA16</constant>, | |
65 | <constant>GL_INTENSITY</constant>, | |
66 | <constant>GL_INTENSITY4</constant>, | |
67 | <constant>GL_INTENSITY8</constant>, | |
68 | <constant>GL_INTENSITY12</constant>, | |
69 | <constant>GL_INTENSITY16</constant>, | |
70 | <constant>GL_R3_G3_B2</constant>, | |
71 | <constant>GL_RGB</constant>, | |
72 | <constant>GL_RGB4</constant>, | |
73 | <constant>GL_RGB5</constant>, | |
74 | <constant>GL_RGB8</constant>, | |
75 | <constant>GL_RGB10</constant>, | |
76 | <constant>GL_RGB12</constant>, | |
77 | <constant>GL_RGB16</constant>, | |
78 | <constant>GL_RGBA</constant>, | |
79 | <constant>GL_RGBA2</constant>, | |
80 | <constant>GL_RGBA4</constant>, | |
81 | <constant>GL_RGB5_A1</constant>, | |
82 | <constant>GL_RGBA8</constant>, | |
83 | <constant>GL_RGB10_A2</constant>, | |
84 | <constant>GL_RGBA12</constant>, or | |
85 | <constant>GL_RGBA16</constant>. | |
86 | </para> | |
87 | </listitem> | |
88 | </varlistentry> | |
89 | <varlistentry> | |
90 | <term><parameter>x</parameter></term> | |
91 | <term><parameter>y</parameter></term> | |
92 | <listitem> | |
93 | <para> | |
94 | The window space coordinates of the lower-left coordinate of the | |
95 | pixel array to copy. | |
96 | </para> | |
97 | </listitem> | |
98 | </varlistentry> | |
99 | <varlistentry> | |
100 | <term><parameter>width</parameter></term> | |
101 | <listitem> | |
102 | <para> | |
103 | The width of the pixel array to copy. | |
104 | </para> | |
105 | </listitem> | |
106 | </varlistentry> | |
107 | <varlistentry> | |
108 | <term><parameter>height</parameter></term> | |
109 | <listitem> | |
110 | <para> | |
111 | The height of the pixel array to copy. | |
112 | </para> | |
113 | </listitem> | |
114 | </varlistentry> | |
115 | </variablelist> | |
116 | </refsect1> | |
117 | <refsect1 id="description"><title>Description</title> | |
118 | <para> | |
119 | <function>glCopyConvolutionFilter2D</function> defines a two-dimensional convolution filter kernel with pixels | |
120 | from the current <constant>GL_READ_BUFFER</constant> (rather than from main memory, | |
121 | as is the case for <citerefentry><refentrytitle>glConvolutionFilter2D</refentrytitle></citerefentry>). | |
122 | </para> | |
123 | <para> | |
124 | The screen-aligned pixel rectangle with lower-left corner at (<parameter>x</parameter>,\ <parameter>y</parameter>), | |
125 | width <parameter>width</parameter> and height <parameter>height</parameter> | |
126 | is used to define the convolution filter. If any pixels within this | |
127 | region are | |
128 | outside the window that is associated with the GL context, the | |
129 | values obtained for those pixels are undefined. | |
130 | </para> | |
131 | <para> | |
132 | The pixels in the rectangle are processed | |
133 | exactly as if <citerefentry><refentrytitle>glReadPixels</refentrytitle></citerefentry> had been called with <emphasis>format</emphasis> | |
134 | set to RGBA, but the process stops just before final conversion. | |
135 | The R, G, B, and A components of each pixel are next scaled by the four | |
136 | 2D <constant>GL_CONVOLUTION_FILTER_SCALE</constant> parameters and biased by the | |
137 | four 2D <constant>GL_CONVOLUTION_FILTER_BIAS</constant> parameters. | |
138 | (The scale and bias parameters are set by <citerefentry><refentrytitle>glConvolutionParameter</refentrytitle></citerefentry> | |
139 | using the <constant>GL_CONVOLUTION_2D</constant> target and the names | |
140 | <constant>GL_CONVOLUTION_FILTER_SCALE</constant> and <constant>GL_CONVOLUTION_FILTER_BIAS</constant>. | |
141 | The parameters themselves are vectors of four values that are applied to red, | |
142 | green, blue, and alpha, in that order.) | |
143 | The R, G, B, and A values are not clamped to [0,1] at any time during this | |
144 | process. | |
145 | </para> | |
146 | <para> | |
147 | Each pixel is then converted to the internal format specified by | |
148 | <parameter>internalformat</parameter>. | |
149 | This conversion simply maps the component values of the pixel (R, G, B, | |
150 | and A) to the values included in the internal format (red, green, blue, | |
151 | alpha, luminance, and intensity). The mapping is as follows: | |
152 | </para> | |
153 | <para> | |
154 | </para> | |
155 | <informaltable frame="topbot"> | |
156 | <tgroup cols="7" align="left"> | |
157 | <colspec colwidth="3*"/> | |
158 | <colspec colwidth="1*" align="center"/> | |
159 | <colspec colwidth="1*" align="center"/> | |
160 | <colspec colwidth="1*" align="center"/> | |
161 | <colspec colwidth="1*" align="center"/> | |
162 | <colspec colwidth="1.7*" align="center"/> | |
163 | <colspec colwidth="1.7*" align="center"/> | |
164 | <thead> | |
165 | <row> | |
166 | <entry rowsep="1" align="left"><emphasis role="bold"> | |
167 | Internal Format | |
168 | </emphasis></entry> | |
169 | <entry rowsep="1" align="center"><emphasis role="bold"> | |
170 | Red | |
171 | </emphasis></entry> | |
172 | <entry rowsep="1" align="center"><emphasis role="bold"> | |
173 | Green | |
174 | </emphasis></entry> | |
175 | <entry rowsep="1" align="center"><emphasis role="bold"> | |
176 | Blue | |
177 | </emphasis></entry> | |
178 | <entry rowsep="1" align="center"><emphasis role="bold"> | |
179 | Alpha | |
180 | </emphasis></entry> | |
181 | <entry rowsep="1" align="center"><emphasis role="bold"> | |
182 | Luminance | |
183 | </emphasis></entry> | |
184 | <entry rowsep="1" align="center"><emphasis role="bold"> | |
185 | Intensity | |
186 | </emphasis></entry> | |
187 | </row> | |
188 | </thead> | |
189 | <tbody> | |
190 | <row> | |
191 | <entry align="left"> | |
192 | <constant>GL_ALPHA</constant> | |
193 | </entry> | |
194 | <entry align="center"> | |
195 | </entry> | |
196 | <entry align="center"> | |
197 | </entry> | |
198 | <entry align="center"> | |
199 | </entry> | |
200 | <entry align="center"> | |
201 | A | |
202 | </entry> | |
203 | <entry align="center"> | |
204 | </entry> | |
205 | <entry align="center"> | |
206 | ||
207 | </entry> | |
208 | </row> | |
209 | <row> | |
210 | <entry align="left"> | |
211 | <constant>GL_LUMINANCE</constant> | |
212 | </entry> | |
213 | <entry align="center"> | |
214 | </entry> | |
215 | <entry align="center"> | |
216 | </entry> | |
217 | <entry align="center"> | |
218 | </entry> | |
219 | <entry align="center"> | |
220 | </entry> | |
221 | <entry align="center"> | |
222 | R | |
223 | </entry> | |
224 | <entry align="center"> | |
225 | ||
226 | </entry> | |
227 | </row> | |
228 | <row> | |
229 | <entry align="left"> | |
230 | <constant>GL_LUMINANCE_ALPHA</constant> | |
231 | </entry> | |
232 | <entry align="center"> | |
233 | </entry> | |
234 | <entry align="center"> | |
235 | </entry> | |
236 | <entry align="center"> | |
237 | </entry> | |
238 | <entry align="center"> | |
239 | A | |
240 | </entry> | |
241 | <entry align="center"> | |
242 | R | |
243 | </entry> | |
244 | <entry align="center"> | |
245 | ||
246 | </entry> | |
247 | </row> | |
248 | <row> | |
249 | <entry align="left"> | |
250 | <constant>GL_INTENSITY</constant> | |
251 | </entry> | |
252 | <entry align="center"> | |
253 | </entry> | |
254 | <entry align="center"> | |
255 | </entry> | |
256 | <entry align="center"> | |
257 | </entry> | |
258 | <entry align="center"> | |
259 | </entry> | |
260 | <entry align="center"> | |
261 | </entry> | |
262 | <entry align="center"> | |
263 | R | |
264 | </entry> | |
265 | </row> | |
266 | <row> | |
267 | <entry align="left"> | |
268 | <constant>GL_RGB</constant> | |
269 | </entry> | |
270 | <entry align="center"> | |
271 | R | |
272 | </entry> | |
273 | <entry align="center"> | |
274 | G | |
275 | </entry> | |
276 | <entry align="center"> | |
277 | B | |
278 | </entry> | |
279 | <entry align="center"> | |
280 | </entry> | |
281 | <entry align="center"> | |
282 | </entry> | |
283 | <entry align="center"> | |
284 | ||
285 | </entry> | |
286 | </row> | |
287 | <row> | |
288 | <entry align="left"> | |
289 | <constant>GL_RGBA</constant> | |
290 | </entry> | |
291 | <entry align="center"> | |
292 | R | |
293 | </entry> | |
294 | <entry align="center"> | |
295 | G | |
296 | </entry> | |
297 | <entry align="center"> | |
298 | B | |
299 | </entry> | |
300 | <entry align="center"> | |
301 | A | |
302 | </entry> | |
303 | <entry align="center"> | |
304 | </entry> | |
305 | <entry align="center"> | |
306 | ||
307 | </entry> | |
308 | </row> | |
309 | </tbody> | |
310 | </tgroup> | |
311 | </informaltable> | |
312 | <para> | |
313 | The red, green, blue, alpha, luminance, and/or intensity components of | |
314 | the resulting pixels are stored in floating-point rather than integer | |
315 | format. | |
316 | </para> | |
317 | <para> | |
318 | Pixel ordering is such that lower x screen coordinates correspond to | |
319 | lower <emphasis>i</emphasis> filter image coordinates, and lower y screen coordinates | |
320 | correspond to lower <emphasis>j</emphasis> filter image coordinates. | |
321 | </para> | |
322 | <para> | |
323 | Note that after a convolution is performed, the resulting color | |
324 | components are also scaled by their corresponding | |
325 | <constant>GL_POST_CONVOLUTION_c_SCALE</constant> parameters and biased by their | |
326 | corresponding <constant>GL_POST_CONVOLUTION_c_BIAS</constant> parameters (where | |
327 | <emphasis>c</emphasis> takes on the values <emphasis role="bold">RED</emphasis>, <emphasis role="bold">GREEN</emphasis>, <emphasis role="bold">BLUE</emphasis>, and | |
328 | <emphasis role="bold">ALPHA</emphasis>). | |
329 | These parameters are set by <citerefentry><refentrytitle>glPixelTransfer</refentrytitle></citerefentry>. | |
330 | </para> | |
331 | </refsect1> | |
332 | <refsect1 id="notes"><title>Notes</title> | |
333 | <para> | |
334 | <function>glCopyConvolutionFilter2D</function> is present only if <code>ARB_imaging</code> is returned when <citerefentry><refentrytitle>glGetString</refentrytitle></citerefentry> | |
335 | is called with an argument of <constant>GL_EXTENSIONS</constant>. | |
336 | </para> | |
337 | </refsect1> | |
338 | <refsect1 id="errors"><title>Errors</title> | |
339 | <para> | |
340 | <constant>GL_INVALID_ENUM</constant> is generated if <parameter>target</parameter> is not | |
341 | <constant>GL_CONVOLUTION_2D</constant>. | |
342 | </para> | |
343 | <para> | |
344 | <constant>GL_INVALID_ENUM</constant> is generated if <parameter>internalformat</parameter> is not one of the | |
345 | allowable values. | |
346 | </para> | |
347 | <para> | |
348 | <constant>GL_INVALID_VALUE</constant> is generated if <parameter>width</parameter> is less than zero or greater | |
349 | than the maximum supported value. | |
350 | This value may be queried with <citerefentry><refentrytitle>glGetConvolutionParameter</refentrytitle></citerefentry> | |
351 | using target <constant>GL_CONVOLUTION_2D</constant> and name | |
352 | <constant>GL_MAX_CONVOLUTION_WIDTH</constant>. | |
353 | </para> | |
354 | <para> | |
355 | <constant>GL_INVALID_VALUE</constant> is generated if <parameter>height</parameter> is less than zero or greater | |
356 | than the maximum supported value. | |
357 | This value may be queried with <citerefentry><refentrytitle>glGetConvolutionParameter</refentrytitle></citerefentry> | |
358 | using target <constant>GL_CONVOLUTION_2D</constant> and name | |
359 | <constant>GL_MAX_CONVOLUTION_HEIGHT</constant>. | |
360 | </para> | |
361 | <para> | |
362 | <constant>GL_INVALID_OPERATION</constant> is generated if <function>glCopyConvolutionFilter2D</function> is executed | |
363 | between the execution of <citerefentry><refentrytitle>glBegin</refentrytitle></citerefentry> and the corresponding | |
364 | execution of <citerefentry><refentrytitle>glEnd</refentrytitle></citerefentry>. | |
365 | </para> | |
366 | </refsect1> | |
367 | <refsect1 id="associatedgets"><title>Associated Gets</title> | |
368 | <para> | |
369 | <citerefentry><refentrytitle>glGetConvolutionParameter</refentrytitle></citerefentry>, <citerefentry><refentrytitle>glGetConvolutionFilter</refentrytitle></citerefentry> | |
370 | </para> | |
371 | </refsect1> | |
372 | <refsect1 id="seealso"><title>See Also</title> | |
373 | <para> | |
374 | <citerefentry><refentrytitle>glConvolutionFilter2D</refentrytitle></citerefentry>, | |
375 | <citerefentry><refentrytitle>glConvolutionParameter</refentrytitle></citerefentry>, | |
376 | <citerefentry><refentrytitle>glPixelTransfer</refentrytitle></citerefentry> | |
377 | </para> | |
378 | </refsect1> | |
379 | <refsect1 id="Copyright"><title>Copyright</title> | |
380 | <para> | |
381 | Copyright <trademark class="copyright"></trademark> 1991-2006 | |
382 | Silicon Graphics, Inc. This document is licensed under the SGI | |
383 | Free Software B License. For details, see | |
384 | <ulink url="http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/</ulink>. | |
385 | </para> | |
386 | </refsect1> | |
387 | </refentry> |