<?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="glPolygonStipple">
    <refmeta>
        <refmetainfo>
            <copyright>
                <year>1991-2006</year>
                <holder>Silicon Graphics, Inc.</holder>
            </copyright>
        </refmetainfo>
        <refentrytitle>glPolygonStipple</refentrytitle>
        <manvolnum>3G</manvolnum>
    </refmeta>
    <refnamediv>
        <refname>glPolygonStipple</refname>
        <refpurpose>set the polygon stippling pattern</refpurpose>
    </refnamediv>
    <refsynopsisdiv><title>C Specification</title>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glPolygonStipple</function></funcdef>
                <paramdef>const GLubyte * <parameter>pattern</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
    </refsynopsisdiv>
    <!-- eqn: ignoring delim $$ -->
    <refsect1 id="parameters"><title>Parameters</title>
        <variablelist>
        <varlistentry>
            <term><parameter>pattern</parameter></term>
            <listitem>
                <para>
                    Specifies a pointer to a 
                    <inlineequation><mml:math>
                        <!-- eqn: 32  times  32:-->
                        <mml:mrow>
                            <mml:mn>32</mml:mn>
                            <mml:mo>&times;</mml:mo>
                            <mml:mn>32</mml:mn>
                        </mml:mrow>
                    </mml:math></inlineequation>
                    stipple pattern that will be unpacked
                    from memory in the same way that <citerefentry><refentrytitle>glDrawPixels</refentrytitle></citerefentry> unpacks pixels.
                </para>
            </listitem>
        </varlistentry>
        </variablelist>
    </refsect1>
    <refsect1 id="description"><title>Description</title>
        <para>
            Polygon stippling,
            like line stippling
            (see <citerefentry><refentrytitle>glLineStipple</refentrytitle></citerefentry>),
            masks out certain fragments produced by rasterization,
            creating a pattern.
            Stippling is independent of polygon antialiasing.
        </para>
        <para>
            <parameter>pattern</parameter> is a pointer to a 
            <inlineequation><mml:math>
                <!-- eqn: 32  times  32:-->
                <mml:mrow>
                    <mml:mn>32</mml:mn>
                    <mml:mo>&times;</mml:mo>
                    <mml:mn>32</mml:mn>
                </mml:mrow>
            </mml:math></inlineequation>
            stipple pattern that is stored
            in memory just like the pixel data supplied to a <citerefentry><refentrytitle>glDrawPixels</refentrytitle></citerefentry>
            call with
            <emphasis></emphasis>
            height
            and
            <emphasis>width</emphasis>
            both equal to 32, a pixel format
            of <constant>GL_COLOR_INDEX</constant>, and data type
            of <constant>GL_BITMAP</constant>.
            That is,
            the stipple pattern is represented as a 
            <inlineequation><mml:math>
                <!-- eqn: 32  times  32:-->
                <mml:mrow>
                    <mml:mn>32</mml:mn>
                    <mml:mo>&times;</mml:mo>
                    <mml:mn>32</mml:mn>
                </mml:mrow>
            </mml:math></inlineequation>
            array
            of 1-bit color indices packed in unsigned bytes.
            <citerefentry><refentrytitle>glPixelStore</refentrytitle></citerefentry> parameters like <constant>GL_UNPACK_SWAP_BYTES</constant>
            and <constant>GL_UNPACK_LSB_FIRST</constant> affect the assembling of the bits into a
            stipple pattern.
            Pixel transfer operations
            (shift, offset, pixel map)
            are not applied to the stipple image,
            however.
        </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 stipple pattern is
            specified, <parameter>pattern</parameter> is treated as a byte offset into the buffer object's data store.
        </para>
        <para>
            To enable and disable polygon stippling, call
            <citerefentry><refentrytitle>glEnable</refentrytitle></citerefentry> and <citerefentry><refentrytitle>glDisable</refentrytitle></citerefentry>
            with argument <constant>GL_POLYGON_STIPPLE</constant>. Polygon stippling is initially
            disabled. If it's enabled,
            a rasterized polygon fragment with window coordinates 
            <inlineequation><mml:math>
                <!-- eqn: x sub w:-->
                <mml:msub><mml:mi mathvariant="italic">x</mml:mi>
                <mml:mi mathvariant="italic">w</mml:mi>
                </mml:msub>
            </mml:math></inlineequation>
            and 
            <inlineequation><mml:math>
                <!-- eqn: y sub w:-->
                <mml:msub><mml:mi mathvariant="italic">y</mml:mi>
                <mml:mi mathvariant="italic">w</mml:mi>
                </mml:msub>
            </mml:math></inlineequation>
            is sent to the next stage of the GL if and only if the
            (<inlineequation><mml:math>
                <!-- eqn: x sub w mod 32:-->
                <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:mn>32</mml:mn>
                </mml:mrow>
            </mml:math></inlineequation>)th
            bit in the 
            (<inlineequation><mml:math>
                <!-- eqn: y sub w mod 32:-->
                <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:mn>32</mml:mn>
                </mml:mrow>
            </mml:math></inlineequation>)th
            row
            of the stipple pattern is 1 (one).
            When polygon stippling is disabled, it is as if the stipple pattern
            consists of all 1's.
        </para>
    </refsect1>
    <refsect1 id="errors"><title>Errors</title>
        <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>glPolygonStipple</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>glGetPolygonStipple</refentrytitle></citerefentry>
        </para>
        <para>
            <citerefentry><refentrytitle>glIsEnabled</refentrytitle></citerefentry> with argument <constant>GL_POLYGON_STIPPLE</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>glDrawPixels</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glLineStipple</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glPixelStore</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glPixelTransfer</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>
