<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html
  PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN" "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd">
<html
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:mml="http://www.w3.org/1998/Math/MathML"
><head><title>glConvolutionFilter2D</title><link rel="stylesheet" href="style.css" type="text/css"/><meta name="generator" content="DocBook XSL Stylesheets V1.59.1"/><link rel="home" href="index.xml" title="PyOpenGL 2.0.1.07 Man Pages"/><link rel="up" href="reference-GL.xml" title="GL"/><link rel="previous" href="glConvolutionFilter1D.3G.xml" title="glConvolutionFilter1D"/><link rel="next" href="glConvolutionParameter.3G.xml" title="glConvolutionParameter"/></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">glConvolutionFilter2D</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="glConvolutionFilter1D.3G.xml">Prev</a> </td><th width="60%" align="center">GL</th><td width="20%" align="right"> <a accesskey="n" href="glConvolutionParameter.3G.xml">Next</a></td></tr></table><hr/></div><div class="refentry" lang="en"><a name="glConvolutionFilter2D.3G"/><div class="titlepage"/><div class="refnamediv"><a name="glConvolutionFilter2D.3G-name"/><h2>Name</h2><p>glConvolutionFilter2D &#8212; define a two-dimensional convolution filter</p></div><div class="refsynopsisdiv"><a name="glConvolutionFilter2D.3G-c_spec"/><h2>C Specification</h2><table class="funcprototype" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"><code>void <tt>glConvolutionFilter2D</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>GLenum <i><tt>target</tt></i>, GLenum <i><tt>internalformat</tt></i>, GLsizei <i><tt>width</tt></i>, GLsizei <i><tt>height</tt></i>, GLenum <i><tt>format</tt></i>, GLenum <i><tt>type</tt></i>, const GLvoid *<i><tt>image</tt></i>);</code></td></tr></table></div><div class="refsynopsisdiv"><a name="glConvolutionFilter2D.3G-python_spec"/><h2>Python Specification</h2><table class="funcprototype" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"><code><tt>glConvolutionFilter2D</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>target</tt></i>, <i><tt>internalformat</tt></i>, <i><tt>width</tt></i>, <i><tt>height</tt></i>, <i><tt>format</tt></i>, <i><tt>type</tt></i>, <i><tt>image</tt></i>) &#8594; <tt>None</tt></code></td></tr></table></div><div class="refsect1" lang="en"><a name="glConvolutionFilter2D.3G-parameters"/><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><i><tt>target</tt></i></span></dt><dd>
						Must be <tt>GL_CONVOLUTION_2D</tt>.
					</dd><dt><span class="term"><i><tt>internalformat</tt></i></span></dt><dd>
						The internal of the convolution filter kernel. The allowable values are <tt>GL_ALPHA</tt>,
						<tt>GL_ALPHA4</tt>, <tt>GL_ALPHA8</tt>, <tt>GL_ALPHA12</tt>,
						<tt>GL_ALPHA16</tt>, <tt>GL_LUMINANCE</tt>, <tt>GL_LUMINANCE4</tt>,
						<tt>GL_LUMINANCE8</tt>, <tt>GL_LUMINANCE12</tt>,
						<tt>GL_LUMINANCE16</tt>, <tt>GL_LUMINANCE_ALPHA</tt>,
						<tt>GL_LUMINANCE4_ALPHA4</tt>, <tt>GL_LUMINANCE6_ALPHA2</tt>,
						<tt>GL_LUMINANCE8_ALPHA8</tt>, <tt>GL_LUMINANCE12_ALPHA4</tt>,
						<tt>GL_LUMINANCE12_ALPHA12</tt>, <tt>GL_LUMINANCE16_ALPHA16</tt>,
						<tt>GL_INTENSITY</tt>, <tt>GL_INTENSITY4</tt>, <tt>GL_INTENSITY8</tt>,
						<tt>GL_INTENSITY12</tt>, <tt>GL_INTENSITY16</tt>, <tt>GL_R3_G3_B2</tt>,
						<tt>GL_RGB</tt>, <tt>GL_RGB4</tt>, <tt>GL_RGB5</tt>,
						<tt>GL_RGB8</tt>, <tt>GL_RGB10</tt>, <tt>GL_RGB12</tt>,
						<tt>GL_RGB16</tt>, <tt>GL_RGBA</tt>, <tt>GL_RGBA2</tt>,
						<tt>GL_RGBA4</tt>, <tt>GL_RGB5_A1</tt>, <tt>GL_RGBA8</tt>,
						<tt>GL_RGB10_A2</tt>, <tt>GL_RGBA12</tt>, or <tt>GL_RGBA16</tt>.
					</dd><dt><span class="term"><i><tt>width</tt></i></span></dt><dd>
						The width of the pixel array referenced by <i><tt>image</tt></i>.
					</dd><dt><span class="term"><i><tt>height</tt></i></span></dt><dd>
						The height of the pixel array referenced by <i><tt>image</tt></i>.
					</dd><dt><span class="term"><i><tt>format</tt></i></span></dt><dd>
						The of the pixel data in <i><tt>image</tt></i>. The allowable values are
						<tt>GL_RED</tt>, <tt>GL_GREEN</tt>, <tt>GL_BLUE</tt>,
						<tt>GL_ALPHA</tt>, <tt>GL_RGB</tt>, <tt>GL_BGR</tt>,
						<tt>GL_RGBA</tt>, <tt>GL_BGRA</tt>, <tt>GL_LUMINANCE</tt>, and
						<tt>GL_LUMINANCE_ALPHA</tt>.
					</dd><dt><span class="term"><i><tt>type</tt></i></span></dt><dd>
						The type of the pixel data in <i><tt>image</tt></i>. Symbolic constants
						<tt>GL_UNSIGNED_BYTE</tt>, <tt>GL_BYTE</tt>, <tt>GL_BITMAP</tt>,
						<tt>GL_UNSIGNED_SHORT</tt>, <tt>GL_SHORT</tt>,
						<tt>GL_UNSIGNED_INT</tt>, <tt>GL_INT</tt>, <tt>GL_FLOAT</tt>,
						<tt>GL_UNSIGNED_BYTE_3_3_2</tt>, <tt>GL_UNSIGNED_BYTE_2_3_3_REV</tt>,
						<tt>GL_UNSIGNED_SHORT_5_6_5</tt>, <tt>GL_UNSIGNED_SHORT_5_6_5_REV</tt>,
						<tt>GL_UNSIGNED_SHORT_4_4_4_4</tt>, <tt>GL_UNSIGNED_SHORT_4_4_4_4_REV</tt>,
						<tt>GL_UNSIGNED_SHORT_5_5_5_1</tt>, <tt>GL_UNSIGNED_SHORT_1_5_5_5_REV</tt>,
						<tt>GL_UNSIGNED_INT_8_8_8_8</tt>, <tt>GL_UNSIGNED_INT_8_8_8_8_REV</tt>,
						<tt>GL_UNSIGNED_INT_10_10_10_2</tt>, and <tt>GL_UNSIGNED_INT_2_10_10_10_REV</tt>
						are accepted.
					</dd><dt><span class="term"><i><tt>image</tt></i></span></dt><dd>
						Pointer to a two-dimensional array of pixel data that is processed to build the convolution filter kernel.
					</dd></dl></div></div><div class="refsect1" lang="en"><a name="glConvolutionFilter2D.3G-description"/><h2>Description</h2><p>
			<tt>glConvolutionFilter2D</tt> builds a two-dimensional convolution filter kernel from an array of pixels.
			The pixel array specified by <i><tt>width</tt></i>, <i><tt>height</tt></i>,
			<i><tt>format</tt></i>, <i><tt>type</tt></i>, and <i><tt>image</tt></i> is extracted from memory
			and processed just as if <a href="glDrawPixels.3G.xml"><tt>glDrawPixels</tt></a> were called, but processing stops after
			the final expansion to RGBA is completed. The R, G, B, and A components of each pixel are next scaled by the four 2D
			<tt>GL_CONVOLUTION_FILTER_SCALE</tt> parameters and biased by the four 2D
			<tt>GL_CONVOLUTION_FILTER_BIAS</tt> parameters. (The scale and bias parameters are set by <tt>glConvolutionParameter</tt> using the <tt>GL_CONVOLUTION_2D</tt> target and the
			names <tt>GL_CONVOLUTION_FILTER_SCALE</tt> and <tt>GL_CONVOLUTION_FILTER_BIAS</tt>. 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 <i><tt>internalformat</tt></i>. 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:
		</p><div class="informaltable"><table border="1"><colgroup><col/><col align="center"/><col align="center"/><col align="center"/><col align="center"/><col align="center"/><col align="center"/></colgroup><thead><tr><th><span class="bold"><b>Internal Format</b></span></th><th align="center"><span class="bold"><b>Red</b></span></th><th align="center"><span class="bold"><b>Green</b></span></th><th align="center"><span class="bold"><b>Blue</b></span></th><th align="center"><span class="bold"><b>Alpha</b></span></th><th align="center"><span class="bold"><b>Luminance</b></span></th><th align="center"><span class="bold"><b>Intensity</b></span></th></tr></thead><tbody><tr><td><tt>GL_ALPHA</tt></td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center">A</td><td align="center"> </td><td align="center"> </td></tr><tr><td><tt>GL_LUMINANCE</tt></td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center">R</td><td align="center"> </td><td align="center"> </td></tr><tr><td><tt>GL_LUMINANCE_ALPHA</tt></td><td align="center"> </td><td align="center"> </td><td align="center">A</td><td align="center">R</td><td align="center"> </td><td align="center"> </td></tr><tr><td><tt>GL_INTENSITY</tt></td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center">R</td></tr><tr><td><tt>GL_RGB</tt></td><td align="center">R</td><td align="center">G</td><td align="center">B</td><td align="center"> </td><td align="center"> </td><td align="center"> </td></tr><tr><td><tt>GL_RGBA</tt></td><td align="center">R</td><td align="center">G</td><td align="center">B</td><td align="center">A</td><td align="center"> </td><td align="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 They form a two-dimensional filter kernel image indexed with coordinates
			<i><tt>i</tt></i> and <i><tt>j</tt></i> such that <i><tt>i</tt></i> starts at zero and increases
			from left to right, and <i><tt>j</tt></i> starts at zero and increases from bottom to top. Kernel location
			<i><tt>i,j</tt></i> is derived from the <i><tt>N</tt></i>th pixel, where <i><tt>N</tt></i> is
			<i><tt>i</tt></i>+<i><tt>j</tt></i>*<i><tt>width</tt></i>.
		</p><p>
			Note that after a convolution is performed, the resulting color components are also scaled by their corresponding
			<tt>GL_POST_CONVOLUTION_c_SCALE</tt> parameters and biased by their corresponding
			<tt>GL_POST_CONVOLUTION_c_BIAS</tt> parameters (where <i><tt>c</tt></i> takes on the values
			<span class="bold"><b>RED</b></span>, <span class="bold"><b>GREEN</b></span>, <span class="bold"><b>BLUE</b></span>,
			and <span class="bold"><b>ALPHA</b></span>). These parameters are set by <tt>glPixelTransfer</tt>.
		</p></div><div class="refsect1" lang="en"><a name="glConvolutionFilter2D.3G-notes"/><h2>Notes</h2><p>
			<tt>glConvolutionFilter2D</tt> is present only if <tt>GL_ARB_imaging</tt> is returned when
			<a href="glGetString.3G.xml"><tt>glGetString</tt></a> is called with an argument of <tt>GL_EXTENSIONS</tt>.
		</p></div><div class="refsect1" lang="en"><a name="glConvolutionFilter2D.3G-errors"/><h2>Errors</h2><p>
			<tt>GL_INVALID_ENUM</tt> is generated if <i><tt>target</tt></i> is not
			<tt>GL_CONVOLUTION_2D</tt>.
		</p><p>
			<tt>GL_INVALID_ENUM</tt> is generated if <i><tt>internalformat</tt></i> is not one of the allowable
			values.
		</p><p>
			<tt>GL_INVALID_VALUE</tt> is generated if <i><tt>width</tt></i> is less than zero or greater than
			the maximum supported value. This value may be queried with <tt>glGetConvolutionParameter</tt> using target <tt>GL_CONVOLUTION_2D</tt> and name
			<tt>GL_MAX_CONVOLUTION_WIDTH</tt>.
		</p><p>
			<tt>GL_INVALID_VALUE</tt> is generated if <i><tt>height</tt></i> is less than zero or greater than
			the maximum supported value. This value may be queried with <tt>glGetConvolutionParameter</tt> using target <tt>GL_CONVOLUTION_2D</tt> and name
			<tt>GL_MAX_CONVOLUTION_HEIGHT</tt>.
		</p><p>
			<tt>GL_INVALID_ENUM</tt> is generated if <i><tt>format</tt></i> is not one of the allowable values.
		</p><p>
			<tt>GL_INVALID_ENUM</tt> is generated if <i><tt>type</tt></i> is not one of the allowable values.
		</p><p>
			<tt>GL_INVALID_OPERATION</tt> is generated if <tt>glConvolutionFilter2D</tt> is executed
			between the execution of <a href="glBegin.3G.xml"><tt>glBegin</tt></a> and the corresponding execution of <a href="glBegin.3G.xml"><tt>glEnd</tt></a>.
		</p><p>
			<tt>GL_INVALID_OPERATION</tt> is generated if <i><tt>height</tt></i> is one of
			<tt>GL_UNSIGNED_BYTE_3_3_2</tt>, <tt>GL_UNSIGNED_BYTE_2_3_3_REV</tt>,
			<tt>GL_UNSIGNED_SHORT_5_6_5</tt>, or <tt>GL_UNSIGNED_SHORT_5_6_5_REV</tt> and
			<i><tt>format</tt></i> is not <tt>GL_RGB</tt>.
		</p><p>
			<tt>GL_INVALID_OPERATION</tt> is generated if <i><tt>height</tt></i> is one of
			<tt>GL_UNSIGNED_SHORT_4_4_4_4</tt>, <tt>GL_UNSIGNED_SHORT_4_4_4_4_REV</tt>,
			<tt>GL_UNSIGNED_SHORT_5_5_5_1</tt>, <tt>GL_UNSIGNED_SHORT_1_5_5_5_REV</tt>,
			<tt>GL_UNSIGNED_INT_8_8_8_8</tt>, <tt>GL_UNSIGNED_INT_8_8_8_8_REV</tt>,
			<tt>GL_UNSIGNED_INT_10_10_10_2</tt>, or <tt>GL_UNSIGNED_INT_2_10_10_10_REV</tt> and
			<i><tt>format</tt></i> is neither <tt>GL_RGBA</tt> nor <tt>GL_BGRA</tt>.
		</p></div><div class="refsect1" lang="en"><a name="glConvolutionFilter2D.3G-associated_gets"/><h2>Associated Gets</h2><p>
			<tt>glGetConvolutionParameter</tt>, <a href="glGetConvolutionFilter.3G.xml"><tt>glGetConvolutionFilter</tt></a>
		</p></div><div class="refsect1" lang="en"><a name="glConvolutionFilter2D.3G-see_also"/><h2>See Also</h2><p>
			<span class="simplelist"><a href="glConvolutionFilter1D.3G.xml">glConvolutionFilter1D</a>, <a href="glSeparableFilter2D.3G.xml">glSeparableFilter2D</a>, <a href="glConvolutionParameter.3G.xml">glConvolutionParameter</a>, <a href="glPixelTransfer.3G.xml">glPixelTransfer</a></span>
		</p></div></div><div class="navfooter"><hr/><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="glConvolutionFilter1D.3G.xml">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="reference-GL.xml">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="glConvolutionParameter.3G.xml">Next</a></td></tr><tr><td width="40%" align="left" valign="top">glConvolutionFilter1D </td><td width="20%" align="center"><a accesskey="h" href="index.xml">Home</a></td><td width="40%" align="right" valign="top"> glConvolutionParameter</td></tr></table></div></body></html>
