1 <?xml version=
"1.0" encoding=
"UTF-8"?>
2 <!DOCTYPE book PUBLIC
"-//OASIS//DTD DocBook MathML Module V1.1b1//EN"
3 "http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd">
9 <holder>Silicon Graphics, Inc.
</holder>
12 <refentrytitle>glRect
</refentrytitle>
13 <manvolnum>3G
</manvolnum>
16 <refname>glRect
</refname>
17 <refpurpose>draw a rectangle
</refpurpose>
19 <refsynopsisdiv><title>C Specification
</title>
22 <funcdef>void
<function>glRectd
</function></funcdef>
23 <paramdef>GLdouble
<parameter>x1
</parameter></paramdef>
24 <paramdef>GLdouble
<parameter>y1
</parameter></paramdef>
25 <paramdef>GLdouble
<parameter>x2
</parameter></paramdef>
26 <paramdef>GLdouble
<parameter>y2
</parameter></paramdef>
31 <funcdef>void
<function>glRectf
</function></funcdef>
32 <paramdef>GLfloat
<parameter>x1
</parameter></paramdef>
33 <paramdef>GLfloat
<parameter>y1
</parameter></paramdef>
34 <paramdef>GLfloat
<parameter>x2
</parameter></paramdef>
35 <paramdef>GLfloat
<parameter>y2
</parameter></paramdef>
40 <funcdef>void
<function>glRecti
</function></funcdef>
41 <paramdef>GLint
<parameter>x1
</parameter></paramdef>
42 <paramdef>GLint
<parameter>y1
</parameter></paramdef>
43 <paramdef>GLint
<parameter>x2
</parameter></paramdef>
44 <paramdef>GLint
<parameter>y2
</parameter></paramdef>
49 <funcdef>void
<function>glRects
</function></funcdef>
50 <paramdef>GLshort
<parameter>x1
</parameter></paramdef>
51 <paramdef>GLshort
<parameter>y1
</parameter></paramdef>
52 <paramdef>GLshort
<parameter>x2
</parameter></paramdef>
53 <paramdef>GLshort
<parameter>y2
</parameter></paramdef>
57 <refsect1 id=
"parameters"><title>Parameters
</title>
60 <term><parameter>x1
</parameter></term>
61 <term><parameter>y1
</parameter></term>
64 Specify one vertex of a rectangle.
69 <term><parameter>x2
</parameter></term>
70 <term><parameter>y2
</parameter></term>
73 Specify the opposite vertex of the rectangle.
79 <refsynopsisdiv><title>C Specification
</title>
82 <funcdef>void
<function>glRectdv
</function></funcdef>
83 <paramdef>const GLdouble *
<parameter>v1
</parameter></paramdef>
84 <paramdef>const GLdouble *
<parameter>v2
</parameter></paramdef>
89 <funcdef>void
<function>glRectfv
</function></funcdef>
90 <paramdef>const GLfloat *
<parameter>v1
</parameter></paramdef>
91 <paramdef>const GLfloat *
<parameter>v2
</parameter></paramdef>
96 <funcdef>void
<function>glRectiv
</function></funcdef>
97 <paramdef>const GLint *
<parameter>v1
</parameter></paramdef>
98 <paramdef>const GLint *
<parameter>v2
</parameter></paramdef>
103 <funcdef>void
<function>glRectsv
</function></funcdef>
104 <paramdef>const GLshort *
<parameter>v1
</parameter></paramdef>
105 <paramdef>const GLshort *
<parameter>v2
</parameter></paramdef>
109 <refsect1 id=
"parameters2"><title>Parameters
</title>
112 <term><parameter>v1
</parameter></term>
115 Specifies a pointer to one vertex of a rectangle.
120 <term><parameter>v2
</parameter></term>
123 Specifies a pointer to the opposite vertex of the rectangle.
129 <refsect1 id=
"description"><title>Description
</title>
131 <function>glRect
</function> supports efficient specification of rectangles as two corner points.
133 rectangle command takes four arguments,
134 organized either as two consecutive pairs of
135 <inlineequation><mml:math>
137 <mml:mfenced open=
"(" close=
")">
138 <mml:mi mathvariant=
"italic">x
</mml:mi>
139 <mml:mi mathvariant=
"italic">y
</mml:mi>
141 </mml:math></inlineequation>
143 or as two pointers to arrays,
145 <inlineequation><mml:math>
147 <mml:mfenced open=
"(" close=
")">
148 <mml:mi mathvariant=
"italic">x
</mml:mi>
149 <mml:mi mathvariant=
"italic">y
</mml:mi>
151 </mml:math></inlineequation>
153 The resulting rectangle is defined in the
154 <inlineequation><mml:math>
157 <mml:mi mathvariant=
"italic">z
</mml:mi>
161 </mml:math></inlineequation>
165 <function>glRect
</function>(
<parameter>x1
</parameter>,
<parameter>y1
</parameter>,
<parameter>x2
</parameter>,
<parameter>y2
</parameter>)
166 is exactly equivalent to the following sequence:
168 glBegin(
<constant>GL_POLYGON
</constant>);
169 glVertex2(
<parameter>x1
</parameter>,
<parameter>y1
</parameter>);
170 glVertex2(
<parameter>x2
</parameter>,
<parameter>y1
</parameter>);
171 glVertex2(
<parameter>x2
</parameter>,
<parameter>y2
</parameter>);
172 glVertex2(
<parameter>x1
</parameter>,
<parameter>y2
</parameter>);
175 Note that if the second vertex is above and to the right of the first vertex,
176 the rectangle is constructed with a counterclockwise winding.
179 <refsect1 id=
"errors"><title>Errors
</title>
181 <constant>GL_INVALID_OPERATION
</constant> is generated if
<function>glRect
</function>
182 is executed between the execution of
<citerefentry><refentrytitle>glBegin
</refentrytitle></citerefentry>
183 and the corresponding execution of
<citerefentry><refentrytitle>glEnd
</refentrytitle></citerefentry>.
186 <refsect1 id=
"seealso"><title>See Also
</title>
188 <citerefentry><refentrytitle>glBegin
</refentrytitle></citerefentry>,
189 <citerefentry><refentrytitle>glVertex
</refentrytitle></citerefentry>
192 <refsect1 id=
"Copyright"><title>Copyright
</title>
194 Copyright
<trademark class=
"copyright"></trademark> 1991-
2006
195 Silicon Graphics, Inc. This document is licensed under the SGI
196 Free Software B License. For details, see
197 <ulink url=
"http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/
</ulink>.