<!DOCTYPE refentry [ <!ENTITY % mathent SYSTEM "math.ent"> %mathent; ]>

<!-- Converted by db4-upgrade version 1.1 -->

<refentry xmlns="http://docbook.org/ns/docbook" version="5.0" xml:id="glClear">
    <info>
        <copyright>
            <year>1991-2006</year>
            <holder>Silicon Graphics, Inc.</holder>
        </copyright>
        <copyright>
            <year>2010-2014</year>
            <holder>Khronos Group</holder>
        </copyright>
    </info>
    <refmeta>
        <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 xml: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 three masks are
                    <constant>GL_COLOR_BUFFER_BIT</constant>,
                    <constant>GL_DEPTH_BUFFER_BIT</constant>, and
                    <constant>GL_STENCIL_BUFFER_BIT</constant>.
                </para>
            </listitem>
        </varlistentry>
        </variablelist>
    </refsect1>
    <refsect1 xml: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>glClearDepthf</function>, and
            <function>glClearStencil</function>.
            Multiple color buffers can be cleared simultaneously by selecting
            more than one buffer at a time using <citerefentry><refentrytitle>glDrawBuffers</refentrytitle></citerefentry>.
        </para>
        <para>
            The pixel ownership test,
            the scissor test,
                        sRGB conversion,
            dithering, and the buffer writemasks affect the operation of <function>glClear</function>.
            The scissor box bounds the cleared region.
            Alpha function,
            blend function,
            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_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 xml: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 xml:id="errors"><title>Errors</title>
        <para>
            <constant>GL_INVALID_VALUE</constant> is generated if any bit other than the three defined
            bits is set in <parameter>mask</parameter>.
        </para>
    </refsect1>
    <refsect1 xml:id="associatedgets"><title>Associated Gets</title>
        <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_COLOR_CLEAR_VALUE</constant>
        </para>
        <para>
            <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_STENCIL_CLEAR_VALUE</constant>
        </para>
    </refsect1>
    <refsect1 xml:id="versions">
        <title>API Version Support</title>
        <informaltable>
            <tgroup cols="3" align="left">
                <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="apifunchead.xml" xpointer="xpointer(/*/*)"/>
                <tbody>
                    <row>
                        <entry>glClear</entry>
                        <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="apiversion.xml" xpointer="xpointer(/*/*[@role='es20']/*)"/>
                    </row>
                </tbody>
            </tgroup>
        </informaltable>
    </refsect1>
    <refsect1 xml:id="seealso"><title>See Also</title>
        <para>
            <citerefentry><refentrytitle>glClearBuffer</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glClearColor</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glClearDepthf</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glClearStencil</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glColorMask</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glDepthMask</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glDrawBuffers</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glScissor</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glStencilMask</refentrytitle></citerefentry>
        </para>
    </refsect1>
    <refsect1 xml:id="Copyright"><title>Copyright</title>
        <para>
            Copyright <trademark class="copyright"/> 1991-2006 Silicon Graphics, Inc.
            Copyright <trademark class="copyright"/> 2010-2014 Khronos Group.
            This document is licensed under the SGI Free Software B License.
            For details, see
            <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/</link>.
        </para>
    </refsect1>
</refentry>
