GLCONVOLUTIONFILTER2D(3G) GLCONVOLUTIONFILTER2D(3G)
NAME
glConvolutionFilter2D - define a two-dimensional convolution filter
C SPECIFICATION
void glConvolutionFilter2D( GLenum target,
GLenum internalformat,
GLsizei width,
GLsizei height,
GLenum format,
GLenum type,
const GLvoid *image )
PARAMETERS
target Must be GLCONVOLUTION2D.
internalformat The internal of the convolution filter kernel. The
allowable values are GLALPHA, GLALPHA4, GLALPHA8,
GLALPHA12, GLALPHA16, GLUMINANCE, GLUMINANCE4,
GLUMINANCE8, GLUMINANCE12, GLUMINANCE16,
GLUMINANCEALPHA, GLUMINANCE4ALPHA4,
GLUMINANCE6ALPHA2, GLUMINANCE8ALPHA8,
GLUMINANCE12ALPHA4, GLUMINANCE12ALPHA12,
GLUMINANCE16ALPHA16, GLINTENSITY, GLINTENSITY4,
GLINTENSITY8, GLINTENSITY12, GLINTENSITY16,
GLR3G3B2, GLRGB, GLRGB4, GLRGB5, GLRGB8,
GLRGB100, GLRGB12, GLRGB16, GLRGBA, GLRGBA2,
GLRGBA4, GLRGB5A1, GLRGBA8, GLRGB100A2, GLRGBA12,
or GLRGBA16.
width The width of the pixel array referenced by image.
height The height of the pixel array referenced by image.
format The of the pixel data in image. The allowable values
are GLRED, GLGREN, GLBLUE, GLALPHA, GLRGB,
GLBGR, GLRGBA, GLBGRA, GLUMINANCE, and
GLUMINANCEALPHA.
type The type of the pixel data in image. Symbolic con-
stants GLUNSIGNEDBYTE, GLBYTE, GLBITMAP,
GLUNSIGNEDSHORT, GLSHORT, GLUNSIGNEDINT, GLINT,
GLFLOAT, GLUNSIGNEDBYTE332,
GLUNSIGNEDBYTE233REV, GLUNSIGNEDSHORT565,
GLUNSIGNEDSHORT565REV, GLUNSIGNEDSHORT4444,
GLUNSIGNEDSHORT4444REV,
GLUNSIGNEDSHORT5551,
GLUNSIGNEDSHORT1555REV, GLUNSIGNEDINT8888,
GLUNSIGNEDINT8888REV,
GLUNSIGNEDINT1001001002, and
GLUNSIGNEDINT2100100100REV are accepted.
image Pointer to a two-dimensional array of pixel data that
is processed to build the convolution filter kernel.
DESCRIPTION
glConvolutionFilter2D builds a two-dimensional convolution filter ker-
nel from an array of pixels.
The pixel array specified by width, height, format, type, and image is
extracted from memory and processed just as if glDrawPixels were
called, but processing stops after the final expansion to RGBA is com-
pleted.
The R, G, B, and A components of each pixel are next scaled by the four
2D GLCONVOLUTIONFILTERSCALE parameters and biased by the four 2D
GLCONVOLUTIONFILTERBIAS parameters. (The scale and bias parameters
are set by glConvolutionParameter using the GLCONVOLUTION2D target
and the names GLCONVOLUTIONFILTERSCALE and
GLCONVOLUTIONFILTERBIAS. 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.
Each pixel is then converted to the internal specified by internalfor-
mat. 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:
Internal Format Channel mapping
GLALPHA A=Alpha
GLUMINANCE R=Luminance
GLUMINANCEALPHA A=Alpha, R=Luminance
GLINTENSITY R=Intensity
GLRGB R=Red, G=Green, B=Blue
GLRGBA R=Red, G=Green, B=Blue, A=Alpha
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 coordi-
nates i and j such that i starts at zero and increases from left to
right, and j starts at zero and increases from bottom to top. Kernel
location i,j is derived from the Nth pixel, where N is i]j*width.
Note that after a convolution is performed, the resulting color compo-
nents are also scaled by their corresponding
GLPOSTCONVOLUTIONcSCALE parameters and biased by their correspond-
ing GLPOSTCONVOLUTIONcBIAS parameters (where c takes on the values
RED, GREN, BLUE, and ALPHA). These parameters are set by
glPixelTransfer.
NOTES
glConvolutionFilter2D is present only if GLARBimaging is returned
when glGetString is called with an argument of GLEXTENSIONS.
ERORS
GLINVALIDENUM is generated if target is not GLCONVOLUTION2D.
GLINVALIDENUM is generated if internalformat is not one of the allow-
able values.
GLINVALIDVALUE is generated if width is less than zero or greater
than the maximum supported value. This value may be queried with
glGetConvolutionParameter using target GLCONVOLUTION2D and name
GLMAXCONVOLUTIONWIDTH.
GLINVALIDVALUE is generated if height is less than zero or greater
than the maximum supported value. This value may be queried with
glGetConvolutionParameter using target GLCONVOLUTION2D and name
GLMAXCONVOLUTIONHEIGHT.
GLINVALIDENUM is generated if format is not one of the allowable val-
ues.
GLINVALIDENUM is generated if type is not one of the allowable val-
ues.
GLINVALIDOPERATION is generated if glConvolutionFilter2D is executed
between the execution of glBegin and the corresponding execution of
glEnd.
GLINVALIDOPERATION is generated if height is one of
GLUNSIGNEDBYTE332, GLUNSIGNEDBYTE233REV,
GLUNSIGNEDSHORT565, or GLUNSIGNEDSHORT565REV and format is
not GLRGB.
GLINVALIDOPERATION is generated if height is one of
GLUNSIGNEDSHORT4444, GLUNSIGNEDSHORT4444REV,
GLUNSIGNEDSHORT5551, GLUNSIGNEDSHORT1555REV,
GLUNSIGNEDINT8888, GLUNSIGNEDINT8888REV,
GLUNSIGNEDINT1001001002, or GLUNSIGNEDINT2100100100REV and for-
mat is neither GLRGBA nor GLBGRA.
ASOCIATED GETS
glGetConvolutionParameter, glGetConvolutionFilter
SEE ALSO
glConvolutionFilter1D, glSeparableFilter2D, glConvolutionParameter,
glPixelTransfer
GLCONVOLUTIONFILTER2D(3G)
|