Commit | Line | Data |
---|---|---|
7faf1d71 AW |
1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "xhtml1-transitional.dtd"> |
2 | <!-- saved from url=(0013)about:internet --> | |
3 | <?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> | |
4 | Specify one vertex of a rectangle. | |
5 | </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> | |
6 | Specify the opposite vertex of the rectangle. | |
7 | </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> | |
8 | Specifies a pointer to one vertex of a rectangle. | |
9 | </p></dd><dt><span class="term"><em class="parameter"><code>v2</code></em></span></dt><dd><p> | |
10 | Specifies a pointer to the opposite vertex of the rectangle. | |
11 | </p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><h2>Description</h2><p> | |
12 | <code class="function">glRect</code> supports efficient specification of rectangles as two corner points. | |
13 | Each | |
14 | rectangle command takes four arguments, | |
15 | organized either as two consecutive pairs of | |
16 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
17 | ||
18 | <mml:mfenced open="(" close=")"> | |
19 | <mml:mi mathvariant="italic">x</mml:mi> | |
20 | <mml:mi mathvariant="italic">y</mml:mi> | |
21 | </mml:mfenced> | |
22 | </mml:math> | |
23 | coordinates | |
24 | or as two pointers to arrays, | |
25 | each containing an | |
26 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
27 | ||
28 | <mml:mfenced open="(" close=")"> | |
29 | <mml:mi mathvariant="italic">x</mml:mi> | |
30 | <mml:mi mathvariant="italic">y</mml:mi> | |
31 | </mml:mfenced> | |
32 | </mml:math> | |
33 | pair. | |
34 | The resulting rectangle is defined in the | |
35 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
36 | ||
37 | <mml:mrow> | |
38 | <mml:mi mathvariant="italic">z</mml:mi> | |
39 | <mml:mo>=</mml:mo> | |
40 | <mml:mn>0</mml:mn> | |
41 | </mml:mrow> | |
42 | </mml:math> | |
43 | plane. | |
44 | </p><p> | |
45 | <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>) | |
46 | is exactly equivalent to the following sequence: | |
47 | </p><pre class="programlisting"> | |
48 | glBegin(<code class="constant">GL_POLYGON</code>); | |
49 | glVertex2(<em class="parameter"><code>x1</code></em>, <em class="parameter"><code>y1</code></em>); | |
50 | glVertex2(<em class="parameter"><code>x2</code></em>, <em class="parameter"><code>y1</code></em>); | |
51 | glVertex2(<em class="parameter"><code>x2</code></em>, <em class="parameter"><code>y2</code></em>); | |
52 | glVertex2(<em class="parameter"><code>x1</code></em>, <em class="parameter"><code>y2</code></em>); | |
53 | glEnd(); | |
54 | </pre><p> | |
55 | Note that if the second vertex is above and to the right of the first vertex, | |
56 | the rectangle is constructed with a counterclockwise winding. | |
57 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="errors"></a><h2>Errors</h2><p> | |
58 | <code class="constant">GL_INVALID_OPERATION</code> is generated if <code class="function">glRect</code> | |
59 | is executed between the execution of <a class="citerefentry" href="glBegin.xml"><span class="citerefentry"><span class="refentrytitle">glBegin</span></span></a> | |
60 | and the corresponding execution of <a class="citerefentry" href="glEnd.xml"><span class="citerefentry"><span class="refentrytitle">glEnd</span></span></a>. | |
61 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="seealso"></a><h2>See Also</h2><p> | |
62 | <a class="citerefentry" href="glBegin.xml"><span class="citerefentry"><span class="refentrytitle">glBegin</span></span></a>, | |
63 | <a class="citerefentry" href="glVertex.xml"><span class="citerefentry"><span class="refentrytitle">glVertex</span></span></a> | |
64 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="Copyright"></a><h2>Copyright</h2><p> | |
65 | Copyright <span class="trademark"></span>© 1991-2006 | |
66 | Silicon Graphics, Inc. This document is licensed under the SGI | |
67 | Free Software B License. For details, see | |
68 | <a class="ulink" href="http://oss.sgi.com/projects/FreeB/" target="_top">http://oss.sgi.com/projects/FreeB/</a>. | |
69 | </p></div></div></body></html> |