<?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="glBitmap">
    <refmeta>
        <refmetainfo>
            <copyright>
                <year>1991-2006</year>
                <holder>Silicon Graphics, Inc.</holder>
            </copyright>
        </refmetainfo>
        <refentrytitle>glBitmap</refentrytitle>
        <manvolnum>3G</manvolnum>
    </refmeta>
    <refnamediv>
        <refname>glBitmap</refname>
        <refpurpose>draw a bitmap</refpurpose>
    </refnamediv>
    <refsynopsisdiv><title>C Specification</title>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glBitmap</function></funcdef>
                <paramdef>GLsizei <parameter>width</parameter></paramdef>
                <paramdef>GLsizei <parameter>height</parameter></paramdef>
                <paramdef>GLfloat <parameter>xorig</parameter></paramdef>
                <paramdef>GLfloat <parameter>yorig</parameter></paramdef>
                <paramdef>GLfloat <parameter>xmove</parameter></paramdef>
                <paramdef>GLfloat <parameter>ymove</parameter></paramdef>
                <paramdef>const GLubyte * <parameter>bitmap</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
    </refsynopsisdiv>
    <!-- eqn: ignoring delim $$ -->
    <refsect1 id="parameters"><title>Parameters</title>
        <variablelist>
        <varlistentry>
            <term><parameter>width</parameter></term>
            <term><parameter>height</parameter></term>
            <listitem>
                <para>
                    Specify the pixel width and height of the bitmap image.
                </para>
            </listitem>
        </varlistentry>
        <varlistentry>
            <term><parameter>xorig</parameter></term>
            <term><parameter>yorig</parameter></term>
            <listitem>
                <para>
                    Specify the location of the origin in the bitmap image.
                    The origin is measured from the lower left corner of the bitmap,
                    with right and up being the positive axes.
                </para>
            </listitem>
        </varlistentry>
        <varlistentry>
            <term><parameter>xmove</parameter></term>
            <term><parameter>ymove</parameter></term>
            <listitem>
                <para>
                    Specify the <emphasis>x</emphasis> and <emphasis>y</emphasis> offsets to be added to the current raster position
                    after the bitmap is drawn.
                </para>
            </listitem>
        </varlistentry>
        <varlistentry>
            <term><parameter>bitmap</parameter></term>
            <listitem>
                <para>
                    Specifies the address of the bitmap image.
                </para>
            </listitem>
        </varlistentry>
        </variablelist>
    </refsect1>
    <refsect1 id="description"><title>Description</title>
        <para>
            A bitmap is a binary image.
            When drawn,
            the bitmap is positioned relative to the current raster position,
            and frame buffer pixels corresponding to 1's in the bitmap are
            written using the current raster color or index.
            Frame buffer pixels corresponding to 0's in the bitmap are not modified.
        </para>
        <para>
            <function>glBitmap</function> takes seven arguments.
            The first pair specifies the width and height of the bitmap image.
            The second pair specifies the location of the bitmap origin relative
            to the lower left corner of the bitmap image.
            The third pair of arguments specifies <emphasis>x</emphasis> and <emphasis>y</emphasis> offsets to be added
            to the current raster position after the bitmap has been drawn.
            The final argument is a pointer to the bitmap image itself.
        </para>
        <para>
            If a non-zero named buffer object is bound to the <constant>GL_PIXEL_UNPACK_BUFFER</constant> target 
            (see <citerefentry><refentrytitle>glBindBuffer</refentrytitle></citerefentry>) while a bitmap image is
            specified, <parameter>bitmap</parameter> is treated as a byte offset into the buffer object's data store.
        </para>
        <para>
            The bitmap image is interpreted like image data for the <citerefentry><refentrytitle>glDrawPixels</refentrytitle></citerefentry>
            command,
            with <parameter>width</parameter> and <parameter>height</parameter> corresponding to the width and height arguments
            of that command,
            and with <emphasis>type</emphasis> set to <constant>GL_BITMAP</constant>
            and <emphasis>format</emphasis> set to <constant>GL_COLOR_INDEX</constant>.
            Modes specified using <citerefentry><refentrytitle>glPixelStore</refentrytitle></citerefentry> affect the
            interpretation of bitmap image data;
            modes specified using <citerefentry><refentrytitle>glPixelTransfer</refentrytitle></citerefentry> do not.
        </para>
        <para>
            If the current raster position is invalid, <function>glBitmap</function> is ignored.
            Otherwise,
            the lower left corner of the bitmap image is positioned at the window coordinates
        </para>
        <para>
            <inlineequation><mml:math>
                <!-- eqn: x sub w  =  \(lf   x sub r  -  x sub o   \(rf:-->
                <mml:mrow>
                    <mml:msub><mml:mi mathvariant="italic">x</mml:mi>
                    <mml:mi mathvariant="italic">w</mml:mi>
                    </mml:msub>
                    <mml:mo>=</mml:mo>
                    <mml:mfenced open="&LeftFloor;" close="&RightFloor;">
                        <mml:mrow>
                            <mml:msub><mml:mi mathvariant="italic">x</mml:mi>
                            <mml:mi mathvariant="italic">r</mml:mi>
                            </mml:msub>
                            <mml:mo>-</mml:mo>
                            <mml:msub><mml:mi mathvariant="italic">x</mml:mi>
                            <mml:mi mathvariant="italic">o</mml:mi>
                            </mml:msub>
                        </mml:mrow>
                    </mml:mfenced>
                </mml:mrow>
            </mml:math></inlineequation>
        </para>
        <para>
            <inlineequation><mml:math>
                <!-- eqn: y sub w  =  \(lf   y sub r  -  y sub o   \(rf:-->
                <mml:mrow>
                    <mml:msub><mml:mi mathvariant="italic">y</mml:mi>
                    <mml:mi mathvariant="italic">w</mml:mi>
                    </mml:msub>
                    <mml:mo>=</mml:mo>
                    <mml:mfenced open="&LeftFloor;" close="&RightFloor;">
                        <mml:mrow>
                            <mml:msub><mml:mi mathvariant="italic">y</mml:mi>
                            <mml:mi mathvariant="italic">r</mml:mi>
                            </mml:msub>
                            <mml:mo>-</mml:mo>
                            <mml:msub><mml:mi mathvariant="italic">y</mml:mi>
                            <mml:mi mathvariant="italic">o</mml:mi>
                            </mml:msub>
                        </mml:mrow>
                    </mml:mfenced>
                </mml:mrow>
            </mml:math></inlineequation>
        </para>
        <para>
            where 
            <inlineequation><mml:math>
                <!-- eqn: ( x sub r , y sub r ):-->
                <mml:mfenced open="(" close=")">
                    <mml:msub><mml:mi mathvariant="italic">x</mml:mi>
                    <mml:mi mathvariant="italic">r</mml:mi>
                    </mml:msub>
                    <mml:msub><mml:mi mathvariant="italic">y</mml:mi>
                    <mml:mi mathvariant="italic">r</mml:mi>
                    </mml:msub>
                </mml:mfenced>
            </mml:math></inlineequation>
            is the raster position
            and 
            <inlineequation><mml:math>
                <!-- eqn: ( x sub o , y sub o ):-->
                <mml:mfenced open="(" close=")">
                    <mml:msub><mml:mi mathvariant="italic">x</mml:mi>
                    <mml:mi mathvariant="italic">o</mml:mi>
                    </mml:msub>
                    <mml:msub><mml:mi mathvariant="italic">y</mml:mi>
                    <mml:mi mathvariant="italic">o</mml:mi>
                    </mml:msub>
                </mml:mfenced>
            </mml:math></inlineequation>
            is the bitmap origin.
            Fragments are then generated for each pixel corresponding to a 1 (one)
            in the bitmap image.
            These fragments are generated using the current raster <emphasis>z</emphasis> coordinate,
            color or color index, and current raster texture coordinates.
            They are then treated just as if they had been generated
            by a point, line, or polygon,
            including texture mapping,
            fogging,
            and all per-fragment operations such as alpha and depth testing.
        </para>
        <para>
            After the bitmap has been drawn,
            the <emphasis>x</emphasis> and <emphasis>y</emphasis> coordinates of the current raster position are offset by
            <parameter>xmove</parameter> and <parameter>ymove</parameter>.
            No change is made to the <emphasis>z</emphasis> coordinate of the current raster position,
            or to the current raster color, texture coordinates, or index.
        </para>
    </refsect1>
    <refsect1 id="notes"><title>Notes</title>
        <para>
            To set a valid raster position outside the viewport, first set a valid
            raster position inside the viewport, then call <function>glBitmap</function> with NULL
            as the <parameter>bitmap</parameter> parameter and with <parameter>xmove</parameter> and <parameter>ymove</parameter> set to
            the offsets of the new raster position. This technique is useful when
            panning an image around the viewport.
        </para>
    </refsect1>
    <refsect1 id="errors"><title>Errors</title>
        <para>
            <constant>GL_INVALID_VALUE</constant> is generated if <parameter>width</parameter> or <parameter>height</parameter> is negative.
        </para>
        <para>
            <constant>GL_INVALID_OPERATION</constant> is generated if a non-zero buffer object name is bound to the
            <constant>GL_PIXEL_UNPACK_BUFFER</constant> target and the buffer object's data store is currently mapped.
        </para>
        <para>
            <constant>GL_INVALID_OPERATION</constant> is generated if a non-zero buffer object name is bound to the
            <constant>GL_PIXEL_UNPACK_BUFFER</constant> target and the data would be unpacked from the buffer 
            object such that the memory reads required would exceed the data store size.
        </para>
        <para>
            <constant>GL_INVALID_OPERATION</constant> is generated if <function>glBitmap</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_CURRENT_RASTER_POSITION</constant>
        </para>
        <para>
            <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_CURRENT_RASTER_COLOR</constant>
        </para>
        <para>
            <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_CURRENT_RASTER_SECONDARY_COLOR</constant>
        </para>
        <para>
            <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_CURRENT_RASTER_DISTANCE</constant>
        </para>
        <para>
            <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_CURRENT_RASTER_INDEX</constant>
        </para>
        <para>
            <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_CURRENT_RASTER_TEXTURE_COORDS</constant>
        </para>
        <para>
            <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_CURRENT_RASTER_POSITION_VALID</constant>
        </para>
        <para>
            <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_PIXEL_UNPACK_BUFFER_BINDING</constant>
        </para>
    </refsect1>
    <refsect1 id="seealso"><title>See Also</title>
        <para>
            <citerefentry><refentrytitle>glBindBuffer</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glDrawPixels</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glPixelStore</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glPixelTransfer</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glRasterPos</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glWindowPos</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>
