glConvolutionFilter2D.3   [plain text]


'\" t  
'\"macro stdmacro
.ds Vn Version 1.2
.ds Dt 24 September 1999
.ds Re Release 1.2.1
.ds Dp May 22 14:44
.ds Dm 2 May 22 14:
.ds Xs 37578     9
.TH GLCONVOLUTIONFILTER2D 3G
.SH NAME
.B "glConvolutionFilter2D
\- define a two-dimensional convolution filter

.SH C SPECIFICATION
void \f3glConvolutionFilter2D\fP(
GLenum \fItarget\fP,
.nf
.ta \w'\f3void \fPglConvolutionFilter2D( 'u
	GLenum \fIinternalformat\fP,
	GLsizei \fIwidth\fP,
	GLsizei \fIheight\fP,
	GLenum \fIformat\fP,
	GLenum \fItype\fP,
	const GLvoid \fI*image\fP )
.fi

.SH PARAMETERS
.TP \w'\fIinternalformat\fP\ \ 'u 
\f2target\fP
Must be \%\f3GL_CONVOLUTION_2D\fP.
.TP
\f2internalformat\fP
The internal  of the convolution filter kernel.
The allowable values are
\%\f3GL_ALPHA\fP,
\%\f3GL_ALPHA4\fP,
\%\f3GL_ALPHA8\fP,
\%\f3GL_ALPHA12\fP,
\%\f3GL_ALPHA16\fP,
\%\f3GL_LUMINANCE\fP,
\%\f3GL_LUMINANCE4\fP,
\%\f3GL_LUMINANCE8\fP,
\%\f3GL_LUMINANCE12\fP,
\%\f3GL_LUMINANCE16\fP,
\%\f3GL_LUMINANCE_ALPHA\fP,
\%\f3GL_LUMINANCE4_ALPHA4\fP,
\%\f3GL_LUMINANCE6_ALPHA2\fP,
\%\f3GL_LUMINANCE8_ALPHA8\fP,
\%\f3GL_LUMINANCE12_ALPHA4\fP,
\%\f3GL_LUMINANCE12_ALPHA12\fP,
\%\f3GL_LUMINANCE16_ALPHA16\fP,
\%\f3GL_INTENSITY\fP,
\%\f3GL_INTENSITY4\fP,
\%\f3GL_INTENSITY8\fP,
\%\f3GL_INTENSITY12\fP,
\%\f3GL_INTENSITY16\fP,
\%\f3GL_R3_G3_B2\fP,
\%\f3GL_RGB\fP,
\%\f3GL_RGB4\fP,
\%\f3GL_RGB5\fP,
\%\f3GL_RGB8\fP,
\%\f3GL_RGB10\fP,
\%\f3GL_RGB12\fP,
\%\f3GL_RGB16\fP,
\%\f3GL_RGBA\fP,
\%\f3GL_RGBA2\fP,
\%\f3GL_RGBA4\fP,
\%\f3GL_RGB5_A1\fP,
\%\f3GL_RGBA8\fP,
\%\f3GL_RGB10_A2\fP,
\%\f3GL_RGBA12\fP, or
\%\f3GL_RGBA16\fP.
.TP
\f2width\fP
The width of the pixel array referenced by \f2image\fP.
.TP
\f2height\fP
The height of the pixel array referenced by \f2image\fP.
.TP
\f2format\fP
The  of the pixel data in \f2image\fP.
The allowable values are
\%\f3GL_RED\fP,
\%\f3GL_GREEN\fP,
\%\f3GL_BLUE\fP,
\%\f3GL_ALPHA\fP,
\%\f3GL_RGB\fP,
\%\f3GL_BGR\fP,
\%\f3GL_RGBA\fP,
\%\f3GL_BGRA\fP,
\%\f3GL_LUMINANCE\fP, and
\%\f3GL_LUMINANCE_ALPHA\fP.
.TP
\f2type\fP
The type of the pixel data in \f2image\fP.
Symbolic constants
\%\f3GL_UNSIGNED_BYTE\fP,
\%\f3GL_BYTE\fP,
\%\f3GL_BITMAP\fP,
\%\f3GL_UNSIGNED_SHORT\fP,
\%\f3GL_SHORT\fP,
\%\f3GL_UNSIGNED_INT\fP,
\%\f3GL_INT\fP,
\%\f3GL_FLOAT\fP,
\%\f3GL_UNSIGNED_BYTE_3_3_2\fP,
\%\f3GL_UNSIGNED_BYTE_2_3_3_REV\fP,
\%\f3GL_UNSIGNED_SHORT_5_6_5\fP,
\%\f3GL_UNSIGNED_SHORT_5_6_5_REV\fP,
\%\f3GL_UNSIGNED_SHORT_4_4_4_4\fP,
\%\f3GL_UNSIGNED_SHORT_4_4_4_4_REV\fP,
\%\f3GL_UNSIGNED_SHORT_5_5_5_1\fP,
\%\f3GL_UNSIGNED_SHORT_1_5_5_5_REV\fP,
\%\f3GL_UNSIGNED_INT_8_8_8_8\fP,
\%\f3GL_UNSIGNED_INT_8_8_8_8_REV\fP,
\%\f3GL_UNSIGNED_INT_10_10_10_2\fP, and
\%\f3GL_UNSIGNED_INT_2_10_10_10_REV\fP
are accepted.
.TP
\f2image\fP
Pointer to a two-dimensional array of pixel data that is processed to
build the convolution filter kernel.
.SH DESCRIPTION
\%\f3glConvolutionFilter2D\fP builds a two-dimensional convolution filter kernel from an array of
pixels.
.sp
The pixel array specified by \f2width\fP, \f2height\fP, \f2format\fP, \f2type\fP, and
\f2image\fP is extracted from memory and processed just as if
\%\f3glDrawPixels\fP were called, but processing stops after the final
expansion to RGBA is completed.
.sp
The R, G, B, and A components of each pixel are next scaled by the four
2D \%\f3GL_CONVOLUTION_FILTER_SCALE\fP parameters and biased by the
four 2D \%\f3GL_CONVOLUTION_FILTER_BIAS\fP parameters.
(The scale and bias parameters are set by \%\f3glConvolutionParameter\fP
using the \%\f3GL_CONVOLUTION_2D\fP target and the names
\%\f3GL_CONVOLUTION_FILTER_SCALE\fP and \%\f3GL_CONVOLUTION_FILTER_BIAS\fP.
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.
.sp
Each pixel is then converted to the internal  specified by
\f2internalformat\fP.
This conversion simply maps the component values of the pixel (R, G, B,
and A) to the values included in the internal  (red, green, blue,
alpha, luminance, and intensity).  The mapping is as follows:
.sp
.TS
center;
lb cb cb cb cb cb cb
l c c c c c c.
_
Internal Format	Red	Green	Blue	Alpha	Luminance	Intensity
_
\%\f3GL_ALPHA\fP				A
\%\f3GL_LUMINANCE\fP				R
\%\f3GL_LUMINANCE_ALPHA\fP			A	R
\%\f3GL_INTENSITY\fP						R
\%\f3GL_RGB\fP	R	G	B
\%\f3GL_RGBA\fP	R	G	B	A
_
.TE
.sp
The red, green, blue, alpha, luminance, and/or intensity components of
the resulting pixels are stored in floating-point rather than integer
.
They form a two-dimensional filter kernel image indexed with coordinates
\f2i\fP and \f2j\fP such that \f2i\fP starts at zero and increases from left
to right, and \f2j\fP starts at zero and increases from bottom to top.
Kernel location \f2i,j\fP is derived from the \f2N\fPth pixel,
where \f2N\fP is \f2i\fP+\f2j\fP*\f2width\fP.
.PP
Note that after a convolution is performed, the resulting color
components are also scaled by their corresponding
\%\f3GL_POST_CONVOLUTION_c_SCALE\fP parameters and biased by their
corresponding \%\f3GL_POST_CONVOLUTION_c_BIAS\fP parameters (where
\f2c\fP takes on the values \f3RED\fP, \f3GREEN\fP, \f3BLUE\fP, and
\f3ALPHA\fP).
These parameters are set by \%\f3glPixelTransfer\fP.
.SH NOTES
\%\f3glConvolutionFilter2D\fP is present only if \%\f3GL_ARB_imaging\fP is returned when \%\f3glGetString\fP
is called with an argument of \%\f3GL_EXTENSIONS\fP.
.SH ERRORS
\%\f3GL_INVALID_ENUM\fP is generated if \f2target\fP is not
\%\f3GL_CONVOLUTION_2D\fP.
.P
\%\f3GL_INVALID_ENUM\fP is generated if \f2internalformat\fP is not one of the
allowable values.
.P
\%\f3GL_INVALID_VALUE\fP is generated if \f2width\fP is less than zero or greater
than the maximum supported value.
This value may be queried with \%\f3glGetConvolutionParameter\fP
using target \%\f3GL_CONVOLUTION_2D\fP and name
\%\f3GL_MAX_CONVOLUTION_WIDTH\fP.
.P
\%\f3GL_INVALID_VALUE\fP is generated if \f2height\fP is less than zero or greater
than the maximum supported value.
This value may be queried with \%\f3glGetConvolutionParameter\fP
using target \%\f3GL_CONVOLUTION_2D\fP and name
\%\f3GL_MAX_CONVOLUTION_HEIGHT\fP.
.P
\%\f3GL_INVALID_ENUM\fP is generated if \f2format\fP is not one of the allowable
values.
.P
\%\f3GL_INVALID_ENUM\fP is generated if \f2type\fP is not one of the allowable
values.
.P
\%\f3GL_INVALID_OPERATION\fP is generated if \%\f3glConvolutionFilter2D\fP is executed
between the execution of \%\f3glBegin\fP and the corresponding
execution of \%\f3glEnd\fP.
.P
\%\f3GL_INVALID_OPERATION\fP is generated if \f2height\fP is one of
\%\f3GL_UNSIGNED_BYTE_3_3_2\fP,
\%\f3GL_UNSIGNED_BYTE_2_3_3_REV\fP,
\%\f3GL_UNSIGNED_SHORT_5_6_5\fP, or
\%\f3GL_UNSIGNED_SHORT_5_6_5_REV\fP
and \f2format\fP is not \%\f3GL_RGB\fP.
.P
\%\f3GL_INVALID_OPERATION\fP is generated if \f2height\fP is one of
\%\f3GL_UNSIGNED_SHORT_4_4_4_4\fP,
\%\f3GL_UNSIGNED_SHORT_4_4_4_4_REV\fP,
\%\f3GL_UNSIGNED_SHORT_5_5_5_1\fP,
\%\f3GL_UNSIGNED_SHORT_1_5_5_5_REV\fP,
\%\f3GL_UNSIGNED_INT_8_8_8_8\fP,
\%\f3GL_UNSIGNED_INT_8_8_8_8_REV\fP,
\%\f3GL_UNSIGNED_INT_10_10_10_2\fP, or
\%\f3GL_UNSIGNED_INT_2_10_10_10_REV\fP
and \f2format\fP is neither \%\f3GL_RGBA\fP nor \%\f3GL_BGRA\fP.
.SH ASSOCIATED GETS
\%\f3glGetConvolutionParameter\fP, \%\f3glGetConvolutionFilter\fP
.SH SEE ALSO
\%\f3glConvolutionFilter1D\fP,
\%\f3glSeparableFilter2D\fP,
\%\f3glConvolutionParameter\fP,
\%\f3glPixelTransfer\fP