Subversion Repositories AndroidProjects

Rev

Blame | Last modification | View Log | RSS feed

<?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="glRect">
    <refmeta>
        <refmetainfo>
            <copyright>
                <year>1991-2006</year>
                <holder>Silicon Graphics, Inc.</holder>
            </copyright>
        </refmetainfo>
        <refentrytitle>glRect</refentrytitle>
        <manvolnum>3G</manvolnum>
    </refmeta>
    <refnamediv>
        <refname>glRect</refname>
        <refpurpose>draw a rectangle</refpurpose>
    </refnamediv>
    <refsynopsisdiv><title>C Specification</title>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glRectd</function></funcdef>
                <paramdef>GLdouble <parameter>x1</parameter></paramdef>
                <paramdef>GLdouble <parameter>y1</parameter></paramdef>
                <paramdef>GLdouble <parameter>x2</parameter></paramdef>
                <paramdef>GLdouble <parameter>y2</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glRectf</function></funcdef>
                <paramdef>GLfloat <parameter>x1</parameter></paramdef>
                <paramdef>GLfloat <parameter>y1</parameter></paramdef>
                <paramdef>GLfloat <parameter>x2</parameter></paramdef>
                <paramdef>GLfloat <parameter>y2</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glRecti</function></funcdef>
                <paramdef>GLint <parameter>x1</parameter></paramdef>
                <paramdef>GLint <parameter>y1</parameter></paramdef>
                <paramdef>GLint <parameter>x2</parameter></paramdef>
                <paramdef>GLint <parameter>y2</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glRects</function></funcdef>
                <paramdef>GLshort <parameter>x1</parameter></paramdef>
                <paramdef>GLshort <parameter>y1</parameter></paramdef>
                <paramdef>GLshort <parameter>x2</parameter></paramdef>
                <paramdef>GLshort <parameter>y2</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
    </refsynopsisdiv>
    <refsect1 id="parameters"><title>Parameters</title>
        <variablelist>
        <varlistentry>
            <term><parameter>x1</parameter></term>
            <term><parameter>y1</parameter></term>
            <listitem>
                <para>
                    Specify one vertex of a rectangle.
                </para>
            </listitem>
        </varlistentry>
        <varlistentry>
            <term><parameter>x2</parameter></term>
            <term><parameter>y2</parameter></term>
            <listitem>
                <para>
                    Specify the opposite vertex of the rectangle.
                </para>
            </listitem>
        </varlistentry>
        </variablelist>
    </refsect1>
    <refsynopsisdiv><title>C Specification</title>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glRectdv</function></funcdef>
                <paramdef>const GLdouble * <parameter>v1</parameter></paramdef>
                <paramdef>const GLdouble * <parameter>v2</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glRectfv</function></funcdef>
                <paramdef>const GLfloat * <parameter>v1</parameter></paramdef>
                <paramdef>const GLfloat * <parameter>v2</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glRectiv</function></funcdef>
                <paramdef>const GLint * <parameter>v1</parameter></paramdef>
                <paramdef>const GLint * <parameter>v2</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glRectsv</function></funcdef>
                <paramdef>const GLshort * <parameter>v1</parameter></paramdef>
                <paramdef>const GLshort * <parameter>v2</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
    </refsynopsisdiv>
    <refsect1 id="parameters2"><title>Parameters</title>
        <variablelist>
        <varlistentry>
            <term><parameter>v1</parameter></term>
            <listitem>
                <para>
                    Specifies a pointer to one vertex of a rectangle.
                </para>
            </listitem>
        </varlistentry>
        <varlistentry>
            <term><parameter>v2</parameter></term>
            <listitem>
                <para>
                    Specifies a pointer to the opposite vertex of the rectangle.
                </para>
            </listitem>
        </varlistentry>
        </variablelist>
    </refsect1>
    <refsect1 id="description"><title>Description</title>
        <para>
            <function>glRect</function> supports efficient specification of rectangles as two corner points.
            Each
            rectangle command takes four arguments,
            organized either as two consecutive pairs of
            <inlineequation><mml:math>
                <!-- eqn: (x,y):-->
                <mml:mfenced open="(" close=")">
                    <mml:mi mathvariant="italic">x</mml:mi>
                    <mml:mi mathvariant="italic">y</mml:mi>
                </mml:mfenced>
            </mml:math></inlineequation>
            coordinates
            or as two pointers to arrays,
            each containing an
            <inlineequation><mml:math>
                <!-- eqn: (x,y):-->
                <mml:mfenced open="(" close=")">
                    <mml:mi mathvariant="italic">x</mml:mi>
                    <mml:mi mathvariant="italic">y</mml:mi>
                </mml:mfenced>
            </mml:math></inlineequation>
            pair.
            The resulting rectangle is defined in the
            <inlineequation><mml:math>
                <!-- eqn: z = 0:-->
                <mml:mrow>
                    <mml:mi mathvariant="italic">z</mml:mi>
                    <mml:mo>=</mml:mo>
                    <mml:mn>0</mml:mn>
                </mml:mrow>
            </mml:math></inlineequation>
            plane.
        </para>
        <para>
            <function>glRect</function>(<parameter>x1</parameter>, <parameter>y1</parameter>, <parameter>x2</parameter>, <parameter>y2</parameter>)
            is exactly equivalent to the following sequence:
            <programlisting>
glBegin(<constant>GL_POLYGON</constant>);
glVertex2(<parameter>x1</parameter>, <parameter>y1</parameter>);
glVertex2(<parameter>x2</parameter>, <parameter>y1</parameter>);
glVertex2(<parameter>x2</parameter>, <parameter>y2</parameter>);
glVertex2(<parameter>x1</parameter>, <parameter>y2</parameter>);
glEnd();
            </programlisting>
            Note that if the second vertex is above and to the right of the first vertex,
            the rectangle is constructed with a counterclockwise winding.
        </para>
    </refsect1>
    <refsect1 id="errors"><title>Errors</title>
        <para>
            <constant>GL_INVALID_OPERATION</constant> is generated if <function>glRect</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="seealso"><title>See Also</title>
        <para>
            <citerefentry><refentrytitle>glBegin</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glVertex</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>