| 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"> |
| 5 | <refmeta> |
| 6 | <refmetainfo> |
| 7 | <copyright> |
| 8 | <year>1991-2006</year> |
| 9 | <holder>Silicon Graphics, Inc.</holder> |
| 10 | </copyright> |
| 11 | </refmetainfo> |
| 12 | <refentrytitle>glClear</refentrytitle> |
| 13 | <manvolnum>3G</manvolnum> |
| 14 | </refmeta> |
| 15 | <refnamediv> |
| 16 | <refname>glClear</refname> |
| 17 | <refpurpose>clear buffers to preset values</refpurpose> |
| 18 | </refnamediv> |
| 19 | <refsynopsisdiv><title>C Specification</title> |
| 20 | <funcsynopsis> |
| 21 | <funcprototype> |
| 22 | <funcdef>void <function>glClear</function></funcdef> |
| 23 | <paramdef>GLbitfield <parameter>mask</parameter></paramdef> |
| 24 | </funcprototype> |
| 25 | </funcsynopsis> |
| 26 | </refsynopsisdiv> |
| 27 | <refsect1 id="parameters"><title>Parameters</title> |
| 28 | <variablelist> |
| 29 | <varlistentry> |
| 30 | <term><parameter>mask</parameter></term> |
| 31 | <listitem> |
| 32 | <para> |
| 33 | Bitwise OR of masks that indicate the buffers to be cleared. |
| 34 | The four masks are |
| 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>. |
| 39 | </para> |
| 40 | </listitem> |
| 41 | </varlistentry> |
| 42 | </variablelist> |
| 43 | </refsect1> |
| 44 | <refsect1 id="description"><title>Description</title> |
| 45 | <para> |
| 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>. |
| 51 | </para> |
| 52 | <para> |
| 53 | The pixel ownership test, |
| 54 | the scissor test, |
| 55 | dithering, and the buffer writemasks affect the operation of <function>glClear</function>. |
| 56 | The scissor box bounds the cleared region. |
| 57 | Alpha function, |
| 58 | blend function, |
| 59 | logical operation, |
| 60 | stenciling, |
| 61 | texture mapping, |
| 62 | and depth-buffering are ignored by <function>glClear</function>. |
| 63 | </para> |
| 64 | <para> |
| 65 | <function>glClear</function> takes a single argument that is the bitwise OR of several |
| 66 | values indicating which buffer is to be cleared. |
| 67 | </para> |
| 68 | <para> |
| 69 | The values are as follows: |
| 70 | </para> |
| 71 | <variablelist> |
| 72 | <varlistentry> |
| 73 | <term><constant>GL_COLOR_BUFFER_BIT</constant></term> |
| 74 | <listitem> |
| 75 | <para> |
| 76 | Indicates the buffers currently enabled for color |
| 77 | writing. |
| 78 | </para> |
| 79 | </listitem> |
| 80 | </varlistentry> |
| 81 | <varlistentry> |
| 82 | <term><constant>GL_DEPTH_BUFFER_BIT</constant></term> |
| 83 | <listitem> |
| 84 | <para> |
| 85 | Indicates the depth buffer. |
| 86 | </para> |
| 87 | </listitem> |
| 88 | </varlistentry> |
| 89 | <varlistentry> |
| 90 | <term><constant>GL_ACCUM_BUFFER_BIT</constant></term> |
| 91 | <listitem> |
| 92 | <para> |
| 93 | Indicates the accumulation buffer. |
| 94 | </para> |
| 95 | </listitem> |
| 96 | </varlistentry> |
| 97 | <varlistentry> |
| 98 | <term><constant>GL_STENCIL_BUFFER_BIT</constant></term> |
| 99 | <listitem> |
| 100 | <para> |
| 101 | Indicates the stencil buffer. |
| 102 | </para> |
| 103 | </listitem> |
| 104 | </varlistentry> |
| 105 | </variablelist> |
| 106 | <para> |
| 107 | The value to which each buffer is cleared depends on the setting of the |
| 108 | clear value for that buffer. |
| 109 | </para> |
| 110 | </refsect1> |
| 111 | <refsect1 id="notes"><title>Notes</title> |
| 112 | <para> |
| 113 | If a buffer is not present, |
| 114 | then a <function>glClear</function> directed at that buffer has no effect. |
| 115 | </para> |
| 116 | </refsect1> |
| 117 | <refsect1 id="errors"><title>Errors</title> |
| 118 | <para> |
| 119 | <constant>GL_INVALID_VALUE</constant> is generated if any bit other than the four defined |
| 120 | bits is set in <parameter>mask</parameter>. |
| 121 | </para> |
| 122 | <para> |
| 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>. |
| 126 | </para> |
| 127 | </refsect1> |
| 128 | <refsect1 id="associatedgets"><title>Associated Gets</title> |
| 129 | <para> |
| 130 | <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_ACCUM_CLEAR_VALUE</constant> |
| 131 | </para> |
| 132 | <para> |
| 133 | <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_DEPTH_CLEAR_VALUE</constant> |
| 134 | </para> |
| 135 | <para> |
| 136 | <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_INDEX_CLEAR_VALUE</constant> |
| 137 | </para> |
| 138 | <para> |
| 139 | <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_COLOR_CLEAR_VALUE</constant> |
| 140 | </para> |
| 141 | <para> |
| 142 | <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_STENCIL_CLEAR_VALUE</constant> |
| 143 | </para> |
| 144 | </refsect1> |
| 145 | <refsect1 id="seealso"><title>See Also</title> |
| 146 | <para> |
| 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> |
| 157 | </para> |
| 158 | </refsect1> |
| 159 | <refsect1 id="Copyright"><title>Copyright</title> |
| 160 | <para> |
| 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>. |
| 165 | </para> |
| 166 | </refsect1> |
| 167 | </refentry> |