<?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="glClear">
    <refmeta>
        <refmetainfo>
            <copyright>
                <year>1991-2006</year>
                <holder>Silicon Graphics, Inc.</holder>
            </copyright>
        </refmetainfo>
        <refentrytitle>glClear</refentrytitle>
        <manvolnum>3G</manvolnum>
    </refmeta>
    <refnamediv>
        <refname>glClear</refname>
        <refpurpose>clear buffers to preset values</refpurpose>
    </refnamediv>
    <refsynopsisdiv><title>C Specification</title>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glClear</function></funcdef>
                <paramdef>GLbitfield <parameter>mask</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
    </refsynopsisdiv>
    <refsect1 id="parameters"><title>Parameters</title>
        <variablelist>
        <varlistentry>
            <term><parameter>mask</parameter></term>
            <listitem>
                <para>
                    Bitwise OR of masks that indicate the buffers to be cleared.
                    The four masks are
                    <constant>GL_COLOR_BUFFER_BIT</constant>,
                    <constant>GL_DEPTH_BUFFER_BIT</constant>,
                    <constant>GL_ACCUM_BUFFER_BIT</constant>, and
                    <constant>GL_STENCIL_BUFFER_BIT</constant>.
                </para>
            </listitem>
        </varlistentry>
        </variablelist>
    </refsect1>
    <refsect1 id="description"><title>Description</title>
        <para>
            <function>glClear</function> sets the bitplane area of the window to values previously selected
            by <function>glClearColor</function>, <function>glClearIndex</function>, <function>glClearDepth</function>,
            <function>glClearStencil</function>, and <function>glClearAccum</function>.
            Multiple color buffers can be cleared simultaneously by selecting
            more than one buffer at a time using <citerefentry><refentrytitle>glDrawBuffer</refentrytitle></citerefentry>.
        </para>
        <para>
            The pixel ownership test,
            the scissor test,
            dithering, and the buffer writemasks affect the operation of <function>glClear</function>.
            The scissor box bounds the cleared region.
            Alpha function,
            blend function,
            logical operation,
            stenciling,
            texture mapping,
            and depth-buffering are ignored by <function>glClear</function>.
        </para>
        <para>
            <function>glClear</function> takes a single argument that is the bitwise OR of several
            values indicating which buffer is to be cleared.
        </para>
        <para>
            The values are as follows:
        </para>
        <variablelist>
            <varlistentry>
                <term><constant>GL_COLOR_BUFFER_BIT</constant></term>
                <listitem>
                    <para>
                        Indicates the buffers currently enabled for color
                        writing.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_DEPTH_BUFFER_BIT</constant></term>
                <listitem>
                    <para>
                        Indicates the depth buffer.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_ACCUM_BUFFER_BIT</constant></term>
                <listitem>
                    <para>
                        Indicates the accumulation buffer.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_STENCIL_BUFFER_BIT</constant></term>
                <listitem>
                    <para>
                        Indicates the stencil buffer.
                    </para>
                </listitem>
            </varlistentry>
        </variablelist>
        <para>
            The value to which each buffer is cleared depends on the setting of the
            clear value for that buffer.
        </para>
    </refsect1>
    <refsect1 id="notes"><title>Notes</title>
        <para>
            If a buffer is not present,
            then a <function>glClear</function> directed at that buffer has no effect.
        </para>
    </refsect1>
    <refsect1 id="errors"><title>Errors</title>
        <para>
            <constant>GL_INVALID_VALUE</constant> is generated if any bit other than the four defined
            bits is set in <parameter>mask</parameter>.
        </para>
        <para>
            <constant>GL_INVALID_OPERATION</constant> is generated if <function>glClear</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>glGet</refentrytitle></citerefentry> with argument <constant>GL_ACCUM_CLEAR_VALUE</constant>
        </para>
        <para>
            <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_DEPTH_CLEAR_VALUE</constant>
        </para>
        <para>
            <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_INDEX_CLEAR_VALUE</constant>
        </para>
        <para>
            <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_COLOR_CLEAR_VALUE</constant>
        </para>
        <para>
            <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_STENCIL_CLEAR_VALUE</constant>
        </para>
    </refsect1>
    <refsect1 id="seealso"><title>See Also</title>
        <para>
            <function>glClearAccum</function>,
            <function>glClearColor</function>,
            <function>glClearDepth</function>,
            <function>glClearIndex</function>,
            <function>glClearStencil</function>,
            <citerefentry><refentrytitle>glColorMask</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glDepthMask</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glDrawBuffer</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glScissor</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glStencilMask</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>
