<?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="glDrawBuffer">
    <refmeta>
        <refmetainfo>
            <copyright>
                <year>1991-2006</year>
                <holder>Silicon Graphics, Inc.</holder>
            </copyright>
        </refmetainfo>
        <refentrytitle>glDrawBuffer</refentrytitle>
        <manvolnum>3G</manvolnum>
    </refmeta>
    <refnamediv>
        <refname>glDrawBuffer</refname>
        <refpurpose>specify which color buffers are to be drawn into</refpurpose>
    </refnamediv>
    <refsynopsisdiv><title>C Specification</title>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glDrawBuffer</function></funcdef>
                <paramdef>GLenum <parameter>mode</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
    </refsynopsisdiv>
    <!-- eqn: ignoring delim $$ -->
    <refsect1 id="parameters"><title>Parameters</title>
        <variablelist>
        <varlistentry>
            <term><parameter>mode</parameter></term>
            <listitem>
                <para>
                    Specifies up to four color buffers to be drawn into.
                    Symbolic constants
                    <constant>GL_NONE</constant>,
                    <constant>GL_FRONT_LEFT</constant>,
                    <constant>GL_FRONT_RIGHT</constant>,
                    <constant>GL_BACK_LEFT</constant>,
                    <constant>GL_BACK_RIGHT</constant>,
                    <constant>GL_FRONT</constant>,
                    <constant>GL_BACK</constant>,
                    <constant>GL_LEFT</constant>,
                    <constant>GL_RIGHT</constant>,
                    <constant>GL_FRONT_AND_BACK</constant>, and
                    <constant>GL_AUX</constant><emphasis>i</emphasis>,
                    where <emphasis>i</emphasis> is between 0 and the value of <constant>GL_AUX_BUFFERS</constant> minus 1,
                    are accepted.  (<constant>GL_AUX_BUFFERS</constant> is not the upper limit; use <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry>
                    to query the number of available aux buffers.)
                    The initial value is <constant>GL_FRONT</constant> for single-buffered contexts,
                    and <constant>GL_BACK</constant> for double-buffered contexts.
                </para>
            </listitem>
        </varlistentry>
        </variablelist>
    </refsect1>
    <refsect1 id="description"><title>Description</title>
        <para>
            When colors are written to the frame buffer,
            they are written into the color buffers specified by <function>glDrawBuffer</function>.
            The specifications are as follows:
        </para>
        <variablelist>
            <varlistentry>
                <term><constant>GL_NONE</constant></term>
                <listitem>
                    <para>
                        No color buffers are written.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_FRONT_LEFT</constant></term>
                <listitem>
                    <para>
                        Only the front left color buffer is written.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_FRONT_RIGHT</constant></term>
                <listitem>
                    <para>
                        Only the front right color buffer is written.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_BACK_LEFT</constant></term>
                <listitem>
                    <para>
                        Only the back left color buffer is written.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_BACK_RIGHT</constant></term>
                <listitem>
                    <para>
                        Only the back right color buffer is written.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_FRONT</constant></term>
                <listitem>
                    <para>
                        Only the front left and front right color buffers are written.
                        If there is no front right color buffer,
                        only the front left color buffer is written.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_BACK</constant></term>
                <listitem>
                    <para>
                        Only the back left and back right color buffers are written.
                        If there is no back right color buffer,
                        only the back left color buffer is written.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_LEFT</constant></term>
                <listitem>
                    <para>
                        Only the front left and back left color buffers are written.
                        If there is no back left color buffer,
                        only the front left color buffer is written.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_RIGHT</constant></term>
                <listitem>
                    <para>
                        Only the front right and back right color buffers are written.
                        If there is no back right color buffer,
                        only the front right color buffer is written.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_FRONT_AND_BACK</constant></term>
                <listitem>
                    <para>
                        All the front and back color buffers
                        (front left, front right, back left, back right)
                        are written.
                        If there are no back color buffers,
                        only the front left and front right color buffers are written.
                        If there are no right color buffers,
                        only the front left and back left color buffers are written.
                        If there are no right or back color buffers,
                        only the front left color buffer is written.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_AUX</constant><emphasis>i</emphasis></term>
                <listitem>
                    <para>
                        Only auxiliary color buffer <emphasis>i</emphasis> is written.
                    </para>
                </listitem>
            </varlistentry>
        </variablelist>
        <para>
            If more than one color buffer is selected for drawing,
            then blending or logical operations are computed and applied independently
            for each color buffer and can produce different results in each buffer.
        </para>
        <para>
            Monoscopic contexts include only
            <emphasis>left</emphasis>
            buffers, and stereoscopic contexts include both
            <emphasis>left</emphasis>
            and
            <emphasis>right</emphasis>
            buffers.
            Likewise, single-buffered contexts include only
            <emphasis>front</emphasis>
            buffers, and double-buffered contexts include both
            <emphasis>front</emphasis>
            and
            <emphasis>back</emphasis>
            buffers.
            The context is selected at GL initialization.
        </para>
    </refsect1>
    <refsect1 id="notes"><title>Notes</title>
        <para>
            It is always the case that <constant>GL_AUX</constant>
            <inlineequation><mml:math><mml:mi mathvariant="italic">i</mml:mi></mml:math></inlineequation>
            = <constant>GL_AUX0</constant> + 
            <inlineequation><mml:math><mml:mi mathvariant="italic">i</mml:mi></mml:math></inlineequation>.
        </para>
    </refsect1>
    <refsect1 id="errors"><title>Errors</title>
        <para>
            <constant>GL_INVALID_ENUM</constant> is generated if <parameter>mode</parameter> is not an accepted value.
        </para>
        <para>
            <constant>GL_INVALID_OPERATION</constant> is generated if none of the buffers indicated
            by <parameter>mode</parameter> exists.
        </para>
        <para>
            <constant>GL_INVALID_OPERATION</constant> is generated if <function>glDrawBuffer</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_DRAW_BUFFER</constant>
        </para>
        <para>
            <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_AUX_BUFFERS</constant>
        </para>
    </refsect1>
    <refsect1 id="seealso"><title>See Also</title>
        <para>
            <citerefentry><refentrytitle>glBlendFunc</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glColorMask</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glIndexMask</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glLogicOp</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glReadBuffer</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>
