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>glViewport
</title><meta name=
"generator" content=
"DocBook XSL Stylesheets V1.73.2" /></head><body><div class=
"refentry" lang=
"en" xml:
lang=
"en"><a id=
"glViewport"></a><div class=
"titlepage"></div><div class=
"refnamediv"><h2>Name
</h2><p>glViewport — set the viewport
</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">glViewport
</b>(
</code></td><td>GLint
</td><td><var class=
"pdparam">x
</var>,
</td></tr><tr><td> </td><td>GLint
</td><td><var class=
"pdparam">y
</var>,
</td></tr><tr><td> </td><td>GLsizei
</td><td><var class=
"pdparam">width
</var>,
</td></tr><tr><td> </td><td>GLsizei
</td><td><var class=
"pdparam">height
</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>x
</code></em>,
</span><span class=
"term"><em class=
"parameter"><code>y
</code></em></span></dt><dd><p>
4 Specify the lower left corner of the viewport rectangle,
5 in pixels. The initial value is (
0,
0).
6 </p></dd><dt><span class=
"term"><em class=
"parameter"><code>width
</code></em>,
</span><span class=
"term"><em class=
"parameter"><code>height
</code></em></span></dt><dd><p>
7 Specify the width and height
9 When a GL context is first attached to a window,
10 <em class=
"parameter"><code>width
</code></em> and
<em class=
"parameter"><code>height
</code></em> are set to the dimensions of that
12 </p></dd></dl></div></div><div class=
"refsect1" lang=
"en" xml:
lang=
"en"><a id=
"description"></a><h2>Description
</h2><p>
13 <code class=
"function">glViewport
</code> specifies the affine transformation of
14 <mml:math xmlns:
mml=
"http://www.w3.org/1998/Math/MathML" overflow=
"scroll"><mml:mi mathvariant=
"italic">x
</mml:mi></mml:math>
16 <mml:math xmlns:
mml=
"http://www.w3.org/1998/Math/MathML" overflow=
"scroll"><mml:mi mathvariant=
"italic">y
</mml:mi></mml:math>
18 normalized device coordinates to window coordinates.
20 <mml:math xmlns:
mml=
"http://www.w3.org/1998/Math/MathML" overflow=
"scroll">
22 <mml:mfenced open=
"(" close=
")">
23 <mml:msub><mml:mi mathvariant=
"italic">x
</mml:mi>
24 <mml:mi mathvariant=
"italic">nd
</mml:mi>
26 <mml:msub><mml:mi mathvariant=
"italic">y
</mml:mi>
27 <mml:mi mathvariant=
"italic">nd
</mml:mi>
31 be normalized device coordinates.
32 Then the window coordinates
33 <mml:math xmlns:
mml=
"http://www.w3.org/1998/Math/MathML" overflow=
"scroll">
35 <mml:mfenced open=
"(" close=
")">
36 <mml:msub><mml:mi mathvariant=
"italic">x
</mml:mi>
37 <mml:mi mathvariant=
"italic">w
</mml:mi>
39 <mml:msub><mml:mi mathvariant=
"italic">y
</mml:mi>
40 <mml:mi mathvariant=
"italic">w
</mml:mi>
44 are computed as follows:
46 </p><div class=
"informalequation"><mml:math xmlns:
mml=
"http://www.w3.org/1998/Math/MathML" overflow=
"scroll">
49 <mml:msub><mml:mi mathvariant=
"italic">x
</mml:mi>
50 <mml:mi mathvariant=
"italic">w
</mml:mi>
54 <mml:mfenced open=
"(" close=
")">
56 <mml:msub><mml:mi mathvariant=
"italic">x
</mml:mi>
57 <mml:mi mathvariant=
"italic">nd
</mml:mi>
64 <mml:mfenced open=
"(" close=
")">
66 <mml:mi mathvariant=
"italic">width
</mml:mi>
71 <mml:mi mathvariant=
"italic">x
</mml:mi>
76 </p><div class=
"informalequation"><mml:math xmlns:
mml=
"http://www.w3.org/1998/Math/MathML" overflow=
"scroll">
79 <mml:msub><mml:mi mathvariant=
"italic">y
</mml:mi>
80 <mml:mi mathvariant=
"italic">w
</mml:mi>
84 <mml:mfenced open=
"(" close=
")">
86 <mml:msub><mml:mi mathvariant=
"italic">y
</mml:mi>
87 <mml:mi mathvariant=
"italic">nd
</mml:mi>
94 <mml:mfenced open=
"(" close=
")">
96 <mml:mi mathvariant=
"italic">height
</mml:mi>
101 <mml:mi mathvariant=
"italic">y
</mml:mi>
106 Viewport width and height are silently clamped
107 to a range that depends on the implementation.
108 To query this range, call
<a class=
"citerefentry" href=
"glGet.xml"><span class=
"citerefentry"><span class=
"refentrytitle">glGet
</span></span></a> with argument
109 <code class=
"constant">GL_MAX_VIEWPORT_DIMS
</code>.
110 </p></div><div class=
"refsect1" lang=
"en" xml:
lang=
"en"><a id=
"errors"></a><h2>Errors
</h2><p>
111 <code class=
"constant">GL_INVALID_VALUE
</code> is generated if either
<em class=
"parameter"><code>width
</code></em> or
<em class=
"parameter"><code>height
</code></em> is negative.
113 <code class=
"constant">GL_INVALID_OPERATION
</code> is generated if
<code class=
"function">glViewport
</code>
114 is executed between the execution of
<a class=
"citerefentry" href=
"glBegin.xml"><span class=
"citerefentry"><span class=
"refentrytitle">glBegin
</span></span></a>
115 and the corresponding execution of
<a class=
"citerefentry" href=
"glEnd.xml"><span class=
"citerefentry"><span class=
"refentrytitle">glEnd
</span></span></a>.
116 </p></div><div class=
"refsect1" lang=
"en" xml:
lang=
"en"><a id=
"associatedgets"></a><h2>Associated Gets
</h2><p>
117 <a class=
"citerefentry" href=
"glGet.xml"><span class=
"citerefentry"><span class=
"refentrytitle">glGet
</span></span></a> with argument
<code class=
"constant">GL_VIEWPORT
</code>
119 <a class=
"citerefentry" href=
"glGet.xml"><span class=
"citerefentry"><span class=
"refentrytitle">glGet
</span></span></a> with argument
<code class=
"constant">GL_MAX_VIEWPORT_DIMS
</code>
120 </p></div><div class=
"refsect1" lang=
"en" xml:
lang=
"en"><a id=
"seealso"></a><h2>See Also
</h2><p>
121 <a class=
"citerefentry" href=
"glDepthRange.xml"><span class=
"citerefentry"><span class=
"refentrytitle">glDepthRange
</span></span></a>
122 </p></div><div class=
"refsect1" lang=
"en" xml:
lang=
"en"><a id=
"Copyright"></a><h2>Copyright
</h2><p>
123 Copyright
<span class=
"trademark"></span>©
1991-
2006
124 Silicon Graphics, Inc. This document is licensed under the SGI
125 Free Software B License. For details, see
126 <a class=
"ulink" href=
"http://oss.sgi.com/projects/FreeB/" target=
"_top">http://oss.sgi.com/projects/FreeB/
</a>.
127 </p></div></div></body></html>