<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook MathML Module V1.1b1//EN"
              "http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd">
<refentry id="glConvolutionParameter">
    <refmeta>
        <refmetainfo>
            <copyright>
                <year>1991-2006</year>
                <holder>Silicon Graphics, Inc.</holder>
            </copyright>
        </refmetainfo>
        <refentrytitle>glConvolutionParameter</refentrytitle>
        <manvolnum>3G</manvolnum>
    </refmeta>
    <refnamediv>
        <refname>glConvolutionParameter</refname>
        <refpurpose>set convolution parameters</refpurpose>
    </refnamediv>
    <refsynopsisdiv><title>C Specification</title>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glConvolutionParameterf</function></funcdef>
                <paramdef>GLenum <parameter>target</parameter></paramdef>
                <paramdef>GLenum <parameter>pname</parameter></paramdef>
                <paramdef>GLfloat <parameter>params</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glConvolutionParameteri</function></funcdef>
                <paramdef>GLenum <parameter>target</parameter></paramdef>
                <paramdef>GLenum <parameter>pname</parameter></paramdef>
                <paramdef>GLint <parameter>params</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
    </refsynopsisdiv>
    <!-- eqn: ignoring delim $$ -->
    <para>
    </para>
    <refsect1 id="parameters"><title>Parameters</title>
        <variablelist>
        <varlistentry>
            <term><parameter>target</parameter></term>
            <listitem>
                <para>
                    The target for the convolution parameter.
                    Must be one of
                    <constant>GL_CONVOLUTION_1D</constant>,
                    <constant>GL_CONVOLUTION_2D</constant>, or
                    <constant>GL_SEPARABLE_2D</constant>.
                </para>
            </listitem>
        </varlistentry>
        <varlistentry>
            <term><parameter>pname</parameter></term>
            <listitem>
                <para>
                    The parameter to be set.
                    Must be
                    <constant>GL_CONVOLUTION_BORDER_MODE</constant>.
                </para>
            </listitem>
        </varlistentry>
        <varlistentry>
            <term><parameter>params</parameter></term>
            <listitem>
                <para>
                    The parameter value.
                    Must be one of
                    <constant>GL_REDUCE</constant>, <constant>GL_CONSTANT_BORDER</constant>, <constant>GL_REPLICATE_BORDER</constant>.
                </para>
                <para>
                </para>
            </listitem>
        </varlistentry>
        </variablelist>
    </refsect1>
    <refsynopsisdiv><title>C Specification</title>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glConvolutionParameterfv</function></funcdef>
                <paramdef>GLenum <parameter>target</parameter></paramdef>
                <paramdef>GLenum <parameter>pname</parameter></paramdef>
                <paramdef>const GLfloat * <parameter>params</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glConvolutionParameteriv</function></funcdef>
                <paramdef>GLenum <parameter>target</parameter></paramdef>
                <paramdef>GLenum <parameter>pname</parameter></paramdef>
                <paramdef>const GLint * <parameter>params</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
    </refsynopsisdiv>
    <para>
    </para>
    <refsect1 id="parameters2"><title>Parameters</title>
        <variablelist>
        <varlistentry>
            <term><parameter>target</parameter></term>
            <listitem>
                <para>
                    The target for the convolution parameter.
                    Must be one of
                    <constant>GL_CONVOLUTION_1D</constant>,
                    <constant>GL_CONVOLUTION_2D</constant>, or
                    <constant>GL_SEPARABLE_2D</constant>.
                </para>
            </listitem>
        </varlistentry>
        <varlistentry>
            <term><parameter>pname</parameter></term>
            <listitem>
                <para>
                    The parameter to be set.
                    Must be one of
                    <constant>GL_CONVOLUTION_BORDER_MODE</constant>,
                    <constant>GL_CONVOLUTION_BORDER_COLOR</constant>,
                    <constant>GL_CONVOLUTION_FILTER_SCALE</constant>, or
                    <constant>GL_CONVOLUTION_FILTER_BIAS</constant>.
                </para>
            </listitem>
        </varlistentry>
        <varlistentry>
            <term><parameter>params</parameter></term>
            <listitem>
                <para>
                    The parameter value.
                    If <parameter>pname</parameter>v is <constant>GL_CONVOLUTION_BORDER_MODE</constant>, <parameter>params</parameter>v must be one of
                    <constant>GL_REDUCE</constant>, <constant>GL_CONSTANT_BORDER</constant>, or <constant>GL_REPLICATE_BORDER</constant>.
                    Otherwise, must be a vector of four values (for red, green, blue, and alpha,
                    respectively) to be used for
                    scaling (when <parameter>pname</parameter>v is <constant>GL_CONVOLUTION_FILTER_SCALE</constant>), or
                    biasing (when <parameter>pname</parameter>v is <constant>GL_CONVOLUTION_FILTER_BIAS</constant>) a convolution
                    filter kernel or setting the constant border color (when <parameter>pname</parameter>v is
                    <constant>GL_CONVOLUTION_BORDER_COLOR</constant>.
                </para>
            </listitem>
        </varlistentry>
        </variablelist>
    </refsect1>
    <refsect1 id="description"><title>Description</title>
        <para>
            <function>glConvolutionParameter</function> sets the value of a convolution parameter.
        </para>
        <para>
            <parameter>target</parameter> selects the convolution filter to be affected:
            <constant>GL_CONVOLUTION_1D</constant>,
            <constant>GL_CONVOLUTION_2D</constant>, or
            <constant>GL_SEPARABLE_2D</constant>
            for the 1D, 2D, or separable 2D filter, respectively.
        </para>
        <para>
            <parameter>pname</parameter> selects the parameter to be changed.
            <constant>GL_CONVOLUTION_FILTER_SCALE</constant> and <constant>GL_CONVOLUTION_FILTER_BIAS</constant>
            affect the definition of the convolution filter kernel; see
            <citerefentry><refentrytitle>glConvolutionFilter1D</refentrytitle></citerefentry>, <citerefentry><refentrytitle>glConvolutionFilter2D</refentrytitle></citerefentry>, and
            <citerefentry><refentrytitle>glSeparableFilter2D</refentrytitle></citerefentry> for details.
            In these cases, <parameter>params</parameter>v is an array of four values to be applied to
            red, green, blue, and alpha values, respectively. The initial value for
            <constant>GL_CONVOLUTION_FILTER_SCALE</constant> is (1, 1, 1, 1), and the initial value
            for <constant>GL_CONVOLUTION_FILTER_BIAS</constant> is (0, 0, 0, 0).
        </para>
        <para>
            A <parameter>pname</parameter> value of <constant>GL_CONVOLUTION_BORDER_MODE</constant> controls the
            convolution border mode. The accepted modes are:
        </para>
        <variablelist>
            <varlistentry>
                <term><constant>GL_REDUCE</constant></term>
                <listitem>
                    <para>
                        The image resulting from convolution is
                        smaller than the source image.
                        If the filter width is 
                        <inlineequation><mml:math><mml:mi mathvariant="italic">Wf</mml:mi></mml:math></inlineequation>
                        and height is 
                        <inlineequation><mml:math><mml:mi mathvariant="italic">Hf</mml:mi></mml:math></inlineequation>,
                        and the source image width is 
                        <inlineequation><mml:math><mml:mi mathvariant="italic">Ws</mml:mi></mml:math></inlineequation>
                        and height is 
                        <inlineequation><mml:math><mml:mi mathvariant="italic">Hs</mml:mi></mml:math></inlineequation>,
                        then the convolved image width will be 
                        <inlineequation><mml:math>
                            <!-- eqn: Ws  -  Wf  +  1:-->
                            <mml:mrow>
                                <mml:mi mathvariant="italic">Ws</mml:mi>
                                <mml:mo>-</mml:mo>
                                <mml:mi mathvariant="italic">Wf</mml:mi>
                                <mml:mo>+</mml:mo>
                                <mml:mn>1</mml:mn>
                            </mml:mrow>
                        </mml:math></inlineequation>
                        and height
                        will be 
                        <inlineequation><mml:math>
                            <!-- eqn: Hs  -  Hf  +  1:-->
                            <mml:mrow>
                                <mml:mi mathvariant="italic">Hs</mml:mi>
                                <mml:mo>-</mml:mo>
                                <mml:mi mathvariant="italic">Hf</mml:mi>
                                <mml:mo>+</mml:mo>
                                <mml:mn>1</mml:mn>
                            </mml:mrow>
                        </mml:math></inlineequation>.
                        (If this reduction would generate an image with zero or negative width
                        and/or height, the output is simply null, with no error generated.)
                        The coordinates of the image resulting from convolution are zero
                        through 
                        <inlineequation><mml:math>
                            <!-- eqn: Ws  -  Wf:-->
                            <mml:mrow>
                                <mml:mi mathvariant="italic">Ws</mml:mi>
                                <mml:mo>-</mml:mo>
                                <mml:mi mathvariant="italic">Wf</mml:mi>
                            </mml:mrow>
                        </mml:math></inlineequation>
                        in width and zero through 
                        <inlineequation><mml:math>
                            <!-- eqn: Hs  -  Hf:-->
                            <mml:mrow>
                                <mml:mi mathvariant="italic">Hs</mml:mi>
                                <mml:mo>-</mml:mo>
                                <mml:mi mathvariant="italic">Hf</mml:mi>
                            </mml:mrow>
                        </mml:math></inlineequation>
                        in
                        height.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_CONSTANT_BORDER</constant></term>
                <listitem>
                    <para>
                        The image resulting from convolution is the same size as the source image, and
                        processed as if the source image were surrounded by pixels with their color
                        specified by the <constant>GL_CONVOLUTION_BORDER_COLOR</constant>.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_REPLICATE_BORDER</constant></term>
                <listitem>
                    <para>
                        The image resulting from convolution is the same size as the source image, and
                        processed as if the outermost pixel on the border of the source image were
                        replicated.
                    </para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsect1>
    <refsect1 id="notes"><title>Notes</title>
        <para>
            <function>glConvolutionParameter</function> is present only if <code>ARB_imaging</code> is returned when <citerefentry><refentrytitle>glGetString</refentrytitle></citerefentry>
            is called with an argument of <constant>GL_EXTENSIONS</constant>.
        </para>
        <para>
            In cases where errors can result from the specification of invalid
            image dimensions, it is the dimensions after convolution that are
            tested, not the dimensions of the source image.
            For example, <citerefentry><refentrytitle>glTexImage1D</refentrytitle></citerefentry> requires power-of-two image size.
            When <constant>GL_REDUCE</constant> border mode is in effect,
            the source image must be larger than the final power-of-two size
            by one less than the size of the 1D filter kernel.
        </para>
    </refsect1>
    <refsect1 id="errors"><title>Errors</title>
        <para>
            <constant>GL_INVALID_ENUM</constant> is generated if <parameter>target</parameter> is not one of the allowable
            values.
        </para>
        <para>
            <constant>GL_INVALID_ENUM</constant> is generated if <parameter>pname</parameter> is not one of the allowable
            values.
        </para>
        <para>
            <constant>GL_INVALID_ENUM</constant> is generated if <parameter>pname</parameter> is
            <constant>GL_CONVOLUTION_BORDER_MODE</constant> and <parameter>params</parameter> is not one of
            <constant>GL_REDUCE</constant>, <constant>GL_CONSTANT_BORDER</constant>, or <constant>GL_REPLICATE_BORDER</constant>.
        </para>
        <para>
            <constant>GL_INVALID_OPERATION</constant> is generated if <function>glConvolutionParameter</function> is executed
            between the execution of <citerefentry><refentrytitle>glBegin</refentrytitle></citerefentry> and the corresponding
            execution of <citerefentry><refentrytitle>glEnd</refentrytitle></citerefentry>.
        </para>
    </refsect1>
    <refsect1 id="associatedgets"><title>Associated Gets</title>
        <para>
            <citerefentry><refentrytitle>glGetConvolutionParameter</refentrytitle></citerefentry>
        </para>
    </refsect1>
    <refsect1 id="seealso"><title>See Also</title>
        <para>
            <citerefentry><refentrytitle>glConvolutionFilter1D</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glConvolutionFilter2D</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glSeparableFilter2D</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glGetConvolutionParameter</refentrytitle></citerefentry>
        </para>
    </refsect1>
    <refsect1 id="Copyright"><title>Copyright</title>
        <para>
            Copyright <trademark class="copyright"></trademark> 1991-2006
            Silicon Graphics, Inc. This document is licensed under the SGI
            Free Software B License. For details, see
            <ulink url="http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/</ulink>.
        </para>
    </refsect1>
</refentry>
