-
Notifications
You must be signed in to change notification settings - Fork 94
/
glCopyConvolutionFilter2D.xhtml
216 lines (211 loc) · 16.2 KB
/
glCopyConvolutionFilter2D.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
<div class="refentry" lang="en" xml:lang="en"><a id="glCopyConvolutionFilter2D"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>glCopyConvolutionFilter2D — copy pixels into a two-dimensional convolution filter</p></div><div class="refsynopsisdiv"><h2>C Specification</h2><div class="funcsynopsis"><table><tr><td><code class="funcdef">void <b class="fsfunc">glCopyConvolutionFilter2D</b>(</code></td><td>GLenum </td><td><var class="pdparam">target</var>, </td></tr><tr><td> </td><td>GLenum </td><td><var class="pdparam">internalformat</var>, </td></tr><tr><td> </td><td>GLint </td><td><var class="pdparam">x</var>, </td></tr><tr><td> </td><td>GLint </td><td><var class="pdparam">y</var>, </td></tr><tr><td> </td><td>GLsizei </td><td><var class="pdparam">width</var>, </td></tr><tr><td> </td><td>GLsizei </td><td><var class="pdparam">height</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>target</code></em></span></dt><dd><p>
Must be <code class="constant">GL_CONVOLUTION_2D</code>.
</p></dd><dt><span class="term"><em class="parameter"><code>internalformat</code></em></span></dt><dd><p>
The internal format of the convolution filter kernel.
The allowable values are
<code class="constant">GL_ALPHA</code>,
<code class="constant">GL_ALPHA4</code>,
<code class="constant">GL_ALPHA8</code>,
<code class="constant">GL_ALPHA12</code>,
<code class="constant">GL_ALPHA16</code>,
<code class="constant">GL_LUMINANCE</code>,
<code class="constant">GL_LUMINANCE4</code>,
<code class="constant">GL_LUMINANCE8</code>,
<code class="constant">GL_LUMINANCE12</code>,
<code class="constant">GL_LUMINANCE16</code>,
<code class="constant">GL_LUMINANCE_ALPHA</code>,
<code class="constant">GL_LUMINANCE4_ALPHA4</code>,
<code class="constant">GL_LUMINANCE6_ALPHA2</code>,
<code class="constant">GL_LUMINANCE8_ALPHA8</code>,
<code class="constant">GL_LUMINANCE12_ALPHA4</code>,
<code class="constant">GL_LUMINANCE12_ALPHA12</code>,
<code class="constant">GL_LUMINANCE16_ALPHA16</code>,
<code class="constant">GL_INTENSITY</code>,
<code class="constant">GL_INTENSITY4</code>,
<code class="constant">GL_INTENSITY8</code>,
<code class="constant">GL_INTENSITY12</code>,
<code class="constant">GL_INTENSITY16</code>,
<code class="constant">GL_R3_G3_B2</code>,
<code class="constant">GL_RGB</code>,
<code class="constant">GL_RGB4</code>,
<code class="constant">GL_RGB5</code>,
<code class="constant">GL_RGB8</code>,
<code class="constant">GL_RGB10</code>,
<code class="constant">GL_RGB12</code>,
<code class="constant">GL_RGB16</code>,
<code class="constant">GL_RGBA</code>,
<code class="constant">GL_RGBA2</code>,
<code class="constant">GL_RGBA4</code>,
<code class="constant">GL_RGB5_A1</code>,
<code class="constant">GL_RGBA8</code>,
<code class="constant">GL_RGB10_A2</code>,
<code class="constant">GL_RGBA12</code>, or
<code class="constant">GL_RGBA16</code>.
</p></dd><dt><span class="term"><em class="parameter"><code>x</code></em>, </span><span class="term"><em class="parameter"><code>y</code></em></span></dt><dd><p>
The window space coordinates of the lower-left coordinate of the
pixel array to copy.
</p></dd><dt><span class="term"><em class="parameter"><code>width</code></em></span></dt><dd><p>
The width of the pixel array to copy.
</p></dd><dt><span class="term"><em class="parameter"><code>height</code></em></span></dt><dd><p>
The height of the pixel array to copy.
</p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><h2>Description</h2><p>
<code class="function">glCopyConvolutionFilter2D</code> defines a two-dimensional convolution filter kernel with pixels
from the current <code class="constant">GL_READ_BUFFER</code> (rather than from main memory,
as is the case for <a class="citerefentry" href="glConvolutionFilter2D"><span class="citerefentry"><span class="refentrytitle">glConvolutionFilter2D</span></span></a>).
</p><p>
The screen-aligned pixel rectangle with lower-left corner at (<em class="parameter"><code>x</code></em>,\ <em class="parameter"><code>y</code></em>),
width <em class="parameter"><code>width</code></em> and height <em class="parameter"><code>height</code></em>
is used to define the convolution filter. If any pixels within this
region are
outside the window that is associated with the GL context, the
values obtained for those pixels are undefined.
</p><p>
The pixels in the rectangle are processed
exactly as if <a class="citerefentry" href="glReadPixels"><span class="citerefentry"><span class="refentrytitle">glReadPixels</span></span></a> had been called with <span class="emphasis"><em>format</em></span>
set to RGBA, but the process stops just before final conversion.
The R, G, B, and A components of each pixel are next scaled by the four
2D <code class="constant">GL_CONVOLUTION_FILTER_SCALE</code> parameters and biased by the
four 2D <code class="constant">GL_CONVOLUTION_FILTER_BIAS</code> parameters.
(The scale and bias parameters are set by <a class="citerefentry" href="glConvolutionParameter"><span class="citerefentry"><span class="refentrytitle">glConvolutionParameter</span></span></a>
using the <code class="constant">GL_CONVOLUTION_2D</code> target and the names
<code class="constant">GL_CONVOLUTION_FILTER_SCALE</code> and <code class="constant">GL_CONVOLUTION_FILTER_BIAS</code>.
The parameters themselves are vectors of four values that are applied to red,
green, blue, and alpha, in that order.)
The R, G, B, and A values are not clamped to [0,1] at any time during this
process.
</p><p>
Each pixel is then converted to the internal format specified by
<em class="parameter"><code>internalformat</code></em>.
This conversion simply maps the component values of the pixel (R, G, B,
and A) to the values included in the internal format (red, green, blue,
alpha, luminance, and intensity). The mapping is as follows:
</p><p>
</p><div class="informaltable"><table><colgroup><col /><col /><col /><col /><col /><col /><col /></colgroup><thead><tr><th><span class="bold"><strong>
Internal Format
</strong></span></th><th class="center"><span class="bold"><strong>
Red
</strong></span></th><th class="center"><span class="bold"><strong>
Green
</strong></span></th><th class="center"><span class="bold"><strong>
Blue
</strong></span></th><th class="center"><span class="bold"><strong>
Alpha
</strong></span></th><th class="center"><span class="bold"><strong>
Luminance
</strong></span></th><th class="center"><span class="bold"><strong>
Intensity
</strong></span></th></tr></thead><tbody><tr><td>
<code class="constant">GL_ALPHA</code>
</td><td class="center">
</td><td class="center">
</td><td class="center">
</td><td class="center">
A
</td><td class="center">
</td><td class="center">
</td></tr><tr><td>
<code class="constant">GL_LUMINANCE</code>
</td><td class="center">
</td><td class="center">
</td><td class="center">
</td><td class="center">
</td><td class="center">
R
</td><td class="center">
</td></tr><tr><td>
<code class="constant">GL_LUMINANCE_ALPHA</code>
</td><td class="center">
</td><td class="center">
</td><td class="center">
</td><td class="center">
A
</td><td class="center">
R
</td><td class="center">
</td></tr><tr><td>
<code class="constant">GL_INTENSITY</code>
</td><td class="center">
</td><td class="center">
</td><td class="center">
</td><td class="center">
</td><td class="center">
</td><td class="center">
R
</td></tr><tr><td>
<code class="constant">GL_RGB</code>
</td><td class="center">
R
</td><td class="center">
G
</td><td class="center">
B
</td><td class="center">
</td><td class="center">
</td><td class="center">
</td></tr><tr><td>
<code class="constant">GL_RGBA</code>
</td><td class="center">
R
</td><td class="center">
G
</td><td class="center">
B
</td><td class="center">
A
</td><td class="center">
</td><td class="center">
</td></tr></tbody></table></div><p>
The red, green, blue, alpha, luminance, and/or intensity components of
the resulting pixels are stored in floating-point rather than integer
format.
</p><p>
Pixel ordering is such that lower x screen coordinates correspond to
lower <span class="emphasis"><em>i</em></span> filter image coordinates, and lower y screen coordinates
correspond to lower <span class="emphasis"><em>j</em></span> filter image coordinates.
</p><p>
Note that after a convolution is performed, the resulting color
components are also scaled by their corresponding
<code class="constant">GL_POST_CONVOLUTION_c_SCALE</code> parameters and biased by their
corresponding <code class="constant">GL_POST_CONVOLUTION_c_BIAS</code> parameters (where
<span class="emphasis"><em>c</em></span> takes on the values <span class="bold"><strong>RED</strong></span>, <span class="bold"><strong>GREEN</strong></span>, <span class="bold"><strong>BLUE</strong></span>, and
<span class="bold"><strong>ALPHA</strong></span>).
These parameters are set by <a class="citerefentry" href="glPixelTransfer"><span class="citerefentry"><span class="refentrytitle">glPixelTransfer</span></span></a>.
</p></div><div class="refsect1" lang="en" xml:lang="en"><a id="notes"></a><h2>Notes</h2><p>
<code class="function">glCopyConvolutionFilter2D</code> is present only if <code class="code">ARB_imaging</code> is returned when <a class="citerefentry" href="glGetString"><span class="citerefentry"><span class="refentrytitle">glGetString</span></span></a>
is called with an argument of <code class="constant">GL_EXTENSIONS</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>target</code></em> is not
<code class="constant">GL_CONVOLUTION_2D</code>.
</p><p>
<code class="constant">GL_INVALID_ENUM</code> is generated if <em class="parameter"><code>internalformat</code></em> is not one of the
allowable values.
</p><p>
<code class="constant">GL_INVALID_VALUE</code> is generated if <em class="parameter"><code>width</code></em> is less than zero or greater
than the maximum supported value.
This value may be queried with <a class="citerefentry" href="glGetConvolutionParameter"><span class="citerefentry"><span class="refentrytitle">glGetConvolutionParameter</span></span></a>
using target <code class="constant">GL_CONVOLUTION_2D</code> and name
<code class="constant">GL_MAX_CONVOLUTION_WIDTH</code>.
</p><p>
<code class="constant">GL_INVALID_VALUE</code> is generated if <em class="parameter"><code>height</code></em> is less than zero or greater
than the maximum supported value.
This value may be queried with <a class="citerefentry" href="glGetConvolutionParameter"><span class="citerefentry"><span class="refentrytitle">glGetConvolutionParameter</span></span></a>
using target <code class="constant">GL_CONVOLUTION_2D</code> and name
<code class="constant">GL_MAX_CONVOLUTION_HEIGHT</code>.
</p><p>
<code class="constant">GL_INVALID_OPERATION</code> is generated if <code class="function">glCopyConvolutionFilter2D</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="glGetConvolutionParameter"><span class="citerefentry"><span class="refentrytitle">glGetConvolutionParameter</span></span></a>, <a class="citerefentry" href="glGetConvolutionFilter"><span class="citerefentry"><span class="refentrytitle">glGetConvolutionFilter</span></span></a>
</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="glConvolutionFilter2D"><span class="citerefentry"><span class="refentrytitle">glConvolutionFilter2D</span></span></a>,
<a class="citerefentry" href="glConvolutionParameter"><span class="citerefentry"><span class="refentrytitle">glConvolutionParameter</span></span></a>,
<a class="citerefentry" href="glPixelTransfer"><span class="citerefentry"><span class="refentrytitle">glPixelTransfer</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>