<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.2//EN" "DTD/docbook/docbookx.dtd">
<!--
License Applicability. Except to the extent portions of this file are
made subject to an alternative license as permitted in the SGI Free
Software License B, Version 1.1 (the "License"), the contents of this
file are subject only to the provisions of the License. You may not use
this file except in compliance with the License. You may obtain a copy
of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
http://oss.sgi.com/projects/FreeB
Note that, as provided in the License, the Software is distributed on an
"AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
Original Code. The Original Code is: OpenGL ES Reference Manual,
Version 1.0, released September 2003, developed by Silicon Graphics,
Inc. The Original Code is Copyright (c) 2003 Silicon Graphics, Inc.
Copyright in any portions created by third parties is as indicated
elsewhere herein. All Rights Reserved.
-->
<refentry id="glClear">
<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>
<title>Parameters</title>
<variablelist>
<varlistentry>
<term>
<parameter>mask</parameter>
</term>
<listitem>
<para>Bitwise OR of masks that indicate the buffers to be
cleared. Valid 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>
<title>Description</title>
<para>
<function>glClear</function>
sets the bitplane area of the window to values previously selected by
<citerefentry><refentrytitle>glClearColor</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glClearDepth</refentrytitle></citerefentry>,
and
<citerefentry><refentrytitle>glClearStencil</refentrytitle></citerefentry>.
</para>
<para>The pixel ownership test, the scissor test, dithering,
and the color buffer masks 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 color buffer.</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>
<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>
<title>Errors</title>
<para><constant>GL_INVALID_VALUE</constant>
is generated if any bit other than the defined bits is set in
<parameter>mask</parameter>.</para>
</refsect1>
<refsect1>
<title>See Also</title>
<para>
<citerefentry><refentrytitle>glClearColor</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glClearDepth</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glClearStencil</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glColorMask</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glEnable</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glScissor</refentrytitle></citerefentry>,
</para>
</refsect1>
</refentry>