1 <?xml version=
"1.0" encoding=
"UTF-8"?>
2 <!DOCTYPE book PUBLIC
"-//OASIS//DTD DocBook MathML Module V1.1b1//EN"
3 "http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd">
4 <refentry id=
"glClear">
9 <holder>Silicon Graphics, Inc.
</holder>
12 <refentrytitle>glClear
</refentrytitle>
13 <manvolnum>3G
</manvolnum>
16 <refname>glClear
</refname>
17 <refpurpose>clear buffers to preset values
</refpurpose>
19 <refsynopsisdiv><title>C Specification
</title>
22 <funcdef>void
<function>glClear
</function></funcdef>
23 <paramdef>GLbitfield
<parameter>mask
</parameter></paramdef>
27 <refsect1 id=
"parameters"><title>Parameters
</title>
30 <term><parameter>mask
</parameter></term>
33 Bitwise OR of masks that indicate the buffers to be cleared.
35 <constant>GL_COLOR_BUFFER_BIT
</constant>,
36 <constant>GL_DEPTH_BUFFER_BIT
</constant>,
37 <constant>GL_ACCUM_BUFFER_BIT
</constant>, and
38 <constant>GL_STENCIL_BUFFER_BIT
</constant>.
44 <refsect1 id=
"description"><title>Description
</title>
46 <function>glClear
</function> sets the bitplane area of the window to values previously selected
47 by
<function>glClearColor
</function>,
<function>glClearIndex
</function>,
<function>glClearDepth
</function>,
48 <function>glClearStencil
</function>, and
<function>glClearAccum
</function>.
49 Multiple color buffers can be cleared simultaneously by selecting
50 more than one buffer at a time using
<citerefentry><refentrytitle>glDrawBuffer
</refentrytitle></citerefentry>.
53 The pixel ownership test,
55 dithering, and the buffer writemasks affect the operation of
<function>glClear
</function>.
56 The scissor box bounds the cleared region.
62 and depth-buffering are ignored by
<function>glClear
</function>.
65 <function>glClear
</function> takes a single argument that is the bitwise OR of several
66 values indicating which buffer is to be cleared.
69 The values are as follows:
73 <term><constant>GL_COLOR_BUFFER_BIT
</constant></term>
76 Indicates the buffers currently enabled for color
82 <term><constant>GL_DEPTH_BUFFER_BIT
</constant></term>
85 Indicates the depth buffer.
90 <term><constant>GL_ACCUM_BUFFER_BIT
</constant></term>
93 Indicates the accumulation buffer.
98 <term><constant>GL_STENCIL_BUFFER_BIT
</constant></term>
101 Indicates the stencil buffer.
107 The value to which each buffer is cleared depends on the setting of the
108 clear value for that buffer.
111 <refsect1 id=
"notes"><title>Notes
</title>
113 If a buffer is not present,
114 then a
<function>glClear
</function> directed at that buffer has no effect.
117 <refsect1 id=
"errors"><title>Errors
</title>
119 <constant>GL_INVALID_VALUE
</constant> is generated if any bit other than the four defined
120 bits is set in
<parameter>mask
</parameter>.
123 <constant>GL_INVALID_OPERATION
</constant> is generated if
<function>glClear
</function>
124 is executed between the execution of
<citerefentry><refentrytitle>glBegin
</refentrytitle></citerefentry>
125 and the corresponding execution of
<citerefentry><refentrytitle>glEnd
</refentrytitle></citerefentry>.
128 <refsect1 id=
"associatedgets"><title>Associated Gets
</title>
130 <citerefentry><refentrytitle>glGet
</refentrytitle></citerefentry> with argument
<constant>GL_ACCUM_CLEAR_VALUE
</constant>
133 <citerefentry><refentrytitle>glGet
</refentrytitle></citerefentry> with argument
<constant>GL_DEPTH_CLEAR_VALUE
</constant>
136 <citerefentry><refentrytitle>glGet
</refentrytitle></citerefentry> with argument
<constant>GL_INDEX_CLEAR_VALUE
</constant>
139 <citerefentry><refentrytitle>glGet
</refentrytitle></citerefentry> with argument
<constant>GL_COLOR_CLEAR_VALUE
</constant>
142 <citerefentry><refentrytitle>glGet
</refentrytitle></citerefentry> with argument
<constant>GL_STENCIL_CLEAR_VALUE
</constant>
145 <refsect1 id=
"seealso"><title>See Also
</title>
147 <function>glClearAccum
</function>,
148 <function>glClearColor
</function>,
149 <function>glClearDepth
</function>,
150 <function>glClearIndex
</function>,
151 <function>glClearStencil
</function>,
152 <citerefentry><refentrytitle>glColorMask
</refentrytitle></citerefentry>,
153 <citerefentry><refentrytitle>glDepthMask
</refentrytitle></citerefentry>,
154 <citerefentry><refentrytitle>glDrawBuffer
</refentrytitle></citerefentry>,
155 <citerefentry><refentrytitle>glScissor
</refentrytitle></citerefentry>,
156 <citerefentry><refentrytitle>glStencilMask
</refentrytitle></citerefentry>
159 <refsect1 id=
"Copyright"><title>Copyright
</title>
161 Copyright
<trademark class=
"copyright"></trademark> 1991-
2006
162 Silicon Graphics, Inc. This document is licensed under the SGI
163 Free Software B License. For details, see
164 <ulink url=
"http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/
</ulink>.