<?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="glPolygonMode">
    <refmeta>
        <refmetainfo>
            <copyright>
                <year>1991-2006</year>
                <holder>Silicon Graphics, Inc.</holder>
            </copyright>
        </refmetainfo>
        <refentrytitle>glPolygonMode</refentrytitle>
        <manvolnum>3G</manvolnum>
    </refmeta>
    <refnamediv>
        <refname>glPolygonMode</refname>
        <refpurpose>select a polygon rasterization mode</refpurpose>
    </refnamediv>
    <refsynopsisdiv><title>C Specification</title>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glPolygonMode</function></funcdef>
                <paramdef>GLenum <parameter>face</parameter></paramdef>
                <paramdef>GLenum <parameter>mode</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
    </refsynopsisdiv>
    <refsect1 id="parameters"><title>Parameters</title>
        <variablelist>
        <varlistentry>
            <term><parameter>face</parameter></term>
            <listitem>
                <para>
                    Specifies the polygons that <parameter>mode</parameter> applies to.
                    Must be
                    <constant>GL_FRONT</constant> for front-facing polygons,
                    <constant>GL_BACK</constant> for back-facing polygons,
                    or <constant>GL_FRONT_AND_BACK</constant> for front- and back-facing polygons.
                </para>
            </listitem>
        </varlistentry>
        <varlistentry>
            <term><parameter>mode</parameter></term>
            <listitem>
                <para>
                    Specifies how polygons will be rasterized.
                    Accepted values are
                    <constant>GL_POINT</constant>,
                    <constant>GL_LINE</constant>, and
                    <constant>GL_FILL</constant>.
                    The initial value is <constant>GL_FILL</constant> for both front- and back-facing polygons.
                </para>
            </listitem>
        </varlistentry>
        </variablelist>
    </refsect1>
    <refsect1 id="description"><title>Description</title>
        <para>
            <function>glPolygonMode</function> controls the interpretation of polygons for rasterization.
            <parameter>face</parameter> describes which polygons <parameter>mode</parameter> applies to:
            front-facing polygons (<constant>GL_FRONT</constant>),
            back-facing polygons (<constant>GL_BACK</constant>),
            or both (<constant>GL_FRONT_AND_BACK</constant>).
            The polygon mode affects only the final rasterization of polygons.
            In particular,
            a polygon's vertices are lit and
            the polygon is clipped and possibly culled before these modes are applied.
        </para>
        <para>
            Three modes are defined and can be specified in <parameter>mode</parameter>:
        </para>
        <variablelist>
            <varlistentry>
                <term><constant>GL_POINT</constant></term>
                <listitem>
                    <para>
                        Polygon vertices that are marked as the start of a boundary edge
                        are drawn as points.
                        Point attributes such as
                        <constant>GL_POINT_SIZE</constant> and
                        <constant>GL_POINT_SMOOTH</constant> control
                        the rasterization of the points.
                        Polygon rasterization attributes other than <constant>GL_POLYGON_MODE</constant> have no effect.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_LINE</constant></term>
                <listitem>
                    <para>
                        Boundary edges of the polygon are drawn as line segments.
                        They are treated as connected line segments for line stippling;
                        the line stipple counter and pattern are not reset between segments
                        (see <citerefentry><refentrytitle>glLineStipple</refentrytitle></citerefentry>).
                        Line attributes such as
                        <constant>GL_LINE_WIDTH</constant> and
                        <constant>GL_LINE_SMOOTH</constant> control
                        the rasterization of the lines.
                        Polygon rasterization attributes other than <constant>GL_POLYGON_MODE</constant> have no effect.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_FILL</constant></term>
                <listitem>
                    <para>
                        The interior of the polygon is filled.
                        Polygon attributes such as
                        <constant>GL_POLYGON_STIPPLE</constant> and
                        <constant>GL_POLYGON_SMOOTH</constant> control the rasterization of the polygon.
                    </para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsect1>
    <refsect1 id="examples"><title>Examples</title>
        <para>
            To draw a surface with filled back-facing polygons
            and outlined front-facing polygons,
            call
            <programlisting>
glPolygonMode(<constant>GL_FRONT</constant>, <constant>GL_LINE</constant>);
            </programlisting>
        </para>
    </refsect1>
    <refsect1 id="notes"><title>Notes</title>
        <para>
            Vertices are marked as boundary or nonboundary with an edge flag.
            Edge flags are generated internally by the GL when it decomposes
            polygons; they can be set explicitly using <citerefentry><refentrytitle>glEdgeFlag</refentrytitle></citerefentry>.
        </para>
    </refsect1>
    <refsect1 id="errors"><title>Errors</title>
        <para>
            <constant>GL_INVALID_ENUM</constant> is generated if either <parameter>face</parameter> or <parameter>mode</parameter> is not
            an accepted value.
        </para>
        <para>
            <constant>GL_INVALID_OPERATION</constant> is generated if <function>glPolygonMode</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_POLYGON_MODE</constant>
        </para>
    </refsect1>
    <refsect1 id="seealso"><title>See Also</title>
        <para>
            <citerefentry><refentrytitle>glBegin</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glEdgeFlag</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glLineStipple</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glLineWidth</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glPointSize</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glPolygonStipple</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>
