<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "xhtml1-transitional.dtd">
<!-- saved from url=(0013)about:internet -->
<?xml-stylesheet type="text/xsl" href="mathml.xsl"?><html xmlns="http://www.w3.org/1999/xhtml" xmlns:pref="http://www.w3.org/2002/Math/preference" pref:renderer="mathplayer-dl"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>glRect</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /></head><body><div class="refentry" lang="en" xml:lang="en"><a id="glRect"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>glRect — draw a rectangle</p></div><div class="refsynopsisdiv"><h2>C Specification</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr><td><code class="funcdef">void <b class="fsfunc">glRectd</b>(</code></td><td>GLdouble  </td><td><var class="pdparam">x1</var>, </td></tr><tr><td> </td><td>GLdouble  </td><td><var class="pdparam">y1</var>, </td></tr><tr><td> </td><td>GLdouble  </td><td><var class="pdparam">x2</var>, </td></tr><tr><td> </td><td>GLdouble  </td><td><var class="pdparam">y2</var><code>)</code>;</td></tr></table></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr><td><code class="funcdef">void <b class="fsfunc">glRectf</b>(</code></td><td>GLfloat  </td><td><var class="pdparam">x1</var>, </td></tr><tr><td> </td><td>GLfloat  </td><td><var class="pdparam">y1</var>, </td></tr><tr><td> </td><td>GLfloat  </td><td><var class="pdparam">x2</var>, </td></tr><tr><td> </td><td>GLfloat  </td><td><var class="pdparam">y2</var><code>)</code>;</td></tr></table></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr><td><code class="funcdef">void <b class="fsfunc">glRecti</b>(</code></td><td>GLint  </td><td><var class="pdparam">x1</var>, </td></tr><tr><td> </td><td>GLint  </td><td><var class="pdparam">y1</var>, </td></tr><tr><td> </td><td>GLint  </td><td><var class="pdparam">x2</var>, </td></tr><tr><td> </td><td>GLint  </td><td><var class="pdparam">y2</var><code>)</code>;</td></tr></table></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr><td><code class="funcdef">void <b class="fsfunc">glRects</b>(</code></td><td>GLshort  </td><td><var class="pdparam">x1</var>, </td></tr><tr><td> </td><td>GLshort  </td><td><var class="pdparam">y1</var>, </td></tr><tr><td> </td><td>GLshort  </td><td><var class="pdparam">x2</var>, </td></tr><tr><td> </td><td>GLshort  </td><td><var class="pdparam">y2</var><code>)</code>;</td></tr></table></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="parameters"></a><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><em class="parameter"><code>x1</code></em>, </span><span class="term"><em class="parameter"><code>y1</code></em></span></dt><dd><p>
                    Specify one vertex of a rectangle.
                </p></dd><dt><span class="term"><em class="parameter"><code>x2</code></em>, </span><span class="term"><em class="parameter"><code>y2</code></em></span></dt><dd><p>
                    Specify the opposite vertex of the rectangle.
                </p></dd></dl></div></div><div class="refsynopsisdiv"><h2>C Specification</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr><td><code class="funcdef">void <b class="fsfunc">glRectdv</b>(</code></td><td>const GLdouble *  </td><td><var class="pdparam">v1</var>, </td></tr><tr><td> </td><td>const GLdouble *  </td><td><var class="pdparam">v2</var><code>)</code>;</td></tr></table></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr><td><code class="funcdef">void <b class="fsfunc">glRectfv</b>(</code></td><td>const GLfloat *  </td><td><var class="pdparam">v1</var>, </td></tr><tr><td> </td><td>const GLfloat *  </td><td><var class="pdparam">v2</var><code>)</code>;</td></tr></table></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr><td><code class="funcdef">void <b class="fsfunc">glRectiv</b>(</code></td><td>const GLint *  </td><td><var class="pdparam">v1</var>, </td></tr><tr><td> </td><td>const GLint *  </td><td><var class="pdparam">v2</var><code>)</code>;</td></tr></table></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr><td><code class="funcdef">void <b class="fsfunc">glRectsv</b>(</code></td><td>const GLshort *  </td><td><var class="pdparam">v1</var>, </td></tr><tr><td> </td><td>const GLshort *  </td><td><var class="pdparam">v2</var><code>)</code>;</td></tr></table></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="parameters2"></a><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><em class="parameter"><code>v1</code></em></span></dt><dd><p>
                    Specifies a pointer to one vertex of a rectangle.
                </p></dd><dt><span class="term"><em class="parameter"><code>v2</code></em></span></dt><dd><p>
                    Specifies a pointer to the opposite vertex of the rectangle.
                </p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><h2>Description</h2><p>
            <code class="function">glRect</code> supports efficient specification of rectangles as two corner points.
            Each
            rectangle command takes four arguments,
            organized either as two consecutive pairs of 
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                
                <mml:mfenced open="(" close=")">
                    <mml:mi mathvariant="italic">x</mml:mi>
                    <mml:mi mathvariant="italic">y</mml:mi>
                </mml:mfenced>
            </mml:math>
            coordinates
            or as two pointers to arrays,
            each containing an 
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                
                <mml:mfenced open="(" close=")">
                    <mml:mi mathvariant="italic">x</mml:mi>
                    <mml:mi mathvariant="italic">y</mml:mi>
                </mml:mfenced>
            </mml:math>
            pair.
            The resulting rectangle is defined in the 
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                
                <mml:mrow>
                    <mml:mi mathvariant="italic">z</mml:mi>
                    <mml:mo>=</mml:mo>
                    <mml:mn>0</mml:mn>
                </mml:mrow>
            </mml:math>
            plane.
        </p><p>
            <code class="function">glRect</code>(<em class="parameter"><code>x1</code></em>, <em class="parameter"><code>y1</code></em>, <em class="parameter"><code>x2</code></em>, <em class="parameter"><code>y2</code></em>)
            is exactly equivalent to the following sequence:
            </p><pre class="programlisting">
glBegin(<code class="constant">GL_POLYGON</code>);
glVertex2(<em class="parameter"><code>x1</code></em>, <em class="parameter"><code>y1</code></em>);
glVertex2(<em class="parameter"><code>x2</code></em>, <em class="parameter"><code>y1</code></em>);
glVertex2(<em class="parameter"><code>x2</code></em>, <em class="parameter"><code>y2</code></em>);
glVertex2(<em class="parameter"><code>x1</code></em>, <em class="parameter"><code>y2</code></em>);
glEnd();
            </pre><p>
            Note that if the second vertex is above and to the right of the first vertex,
            the rectangle is constructed with a counterclockwise winding.
        </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="errors"></a><h2>Errors</h2><p>
            <code class="constant">GL_INVALID_OPERATION</code> is generated if <code class="function">glRect</code>
            is executed between the execution of <a class="citerefentry" href="glBegin.xml"><span class="citerefentry"><span class="refentrytitle">glBegin</span></span></a>
            and the corresponding execution of <a class="citerefentry" href="glEnd.xml"><span class="citerefentry"><span class="refentrytitle">glEnd</span></span></a>.
        </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="seealso"></a><h2>See Also</h2><p>
            <a class="citerefentry" href="glBegin.xml"><span class="citerefentry"><span class="refentrytitle">glBegin</span></span></a>,
            <a class="citerefentry" href="glVertex.xml"><span class="citerefentry"><span class="refentrytitle">glVertex</span></span></a>
        </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="Copyright"></a><h2>Copyright</h2><p>
            Copyright <span class="trademark"></span>© 1991-2006
            Silicon Graphics, Inc. This document is licensed under the SGI
            Free Software B License. For details, see
            <a class="ulink" href="http://oss.sgi.com/projects/FreeB/" target="_top">http://oss.sgi.com/projects/FreeB/</a>.
        </p></div></div></body></html>
