1 <?xml version=
"1.0" encoding=
"UTF-8"?>
2 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN" "xhtml1-transitional.dtd">
3 <!-- saved from url=(0013)about:internet -->
4 <?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" /><link rel=
"stylesheet" type=
"text/css" href=
"opengl-man.css" /><title>glViewport - OpenGL
4 Reference Pages
</title><meta name=
"generator" content=
"DocBook XSL Stylesheets V1.69.1" /></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>
5 Specify the lower left corner of the viewport rectangle,
6 in pixels. The initial value is (
0,
0).
7 </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>
8 Specify the width and height
10 When a GL context is first attached to a window,
11 <em class=
"parameter"><code>width
</code></em> and
<em class=
"parameter"><code>height
</code></em> are set to the dimensions of that
13 </p></dd></dl></div></div><div class=
"refsect1" lang=
"en" xml:
lang=
"en"><a id=
"description"></a><h2>Description
</h2><p>
14 <code class=
"function">glViewport
</code> specifies the affine transformation of
15 <mml:math xmlns:
mml=
"http://www.w3.org/1998/Math/MathML" overflow=
"scroll"><mml:mi mathvariant=
"italic">x
</mml:mi></mml:math>
17 <mml:math xmlns:
mml=
"http://www.w3.org/1998/Math/MathML" overflow=
"scroll"><mml:mi mathvariant=
"italic">y
</mml:mi></mml:math>
19 normalized device coordinates to window coordinates.
21 <mml:math xmlns:
mml=
"http://www.w3.org/1998/Math/MathML" overflow=
"scroll">
23 <mml:mfenced open=
"(" close=
")">
24 <mml:msub><mml:mi mathvariant=
"italic">x
</mml:mi>
25 <mml:mi mathvariant=
"italic">nd
</mml:mi>
27 <mml:msub><mml:mi mathvariant=
"italic">y
</mml:mi>
28 <mml:mi mathvariant=
"italic">nd
</mml:mi>
32 be normalized device coordinates.
33 Then the window coordinates
34 <mml:math xmlns:
mml=
"http://www.w3.org/1998/Math/MathML" overflow=
"scroll">
36 <mml:mfenced open=
"(" close=
")">
37 <mml:msub><mml:mi mathvariant=
"italic">x
</mml:mi>
38 <mml:mi mathvariant=
"italic">w
</mml:mi>
40 <mml:msub><mml:mi mathvariant=
"italic">y
</mml:mi>
41 <mml:mi mathvariant=
"italic">w
</mml:mi>
45 are computed as follows:
47 </p><div class=
"informalequation"><mml:math xmlns:
mml=
"http://www.w3.org/1998/Math/MathML" overflow=
"scroll">
50 <mml:msub><mml:mi mathvariant=
"italic">x
</mml:mi>
51 <mml:mi mathvariant=
"italic">w
</mml:mi>
55 <mml:mfenced open=
"(" close=
")">
57 <mml:msub><mml:mi mathvariant=
"italic">x
</mml:mi>
58 <mml:mi mathvariant=
"italic">nd
</mml:mi>
65 <mml:mfenced open=
"(" close=
")">
67 <mml:mi mathvariant=
"italic">width
</mml:mi>
72 <mml:mi mathvariant=
"italic">x
</mml:mi>
77 </p><div class=
"informalequation"><mml:math xmlns:
mml=
"http://www.w3.org/1998/Math/MathML" overflow=
"scroll">
80 <mml:msub><mml:mi mathvariant=
"italic">y
</mml:mi>
81 <mml:mi mathvariant=
"italic">w
</mml:mi>
85 <mml:mfenced open=
"(" close=
")">
87 <mml:msub><mml:mi mathvariant=
"italic">y
</mml:mi>
88 <mml:mi mathvariant=
"italic">nd
</mml:mi>
95 <mml:mfenced open=
"(" close=
")">
97 <mml:mi mathvariant=
"italic">height
</mml:mi>
102 <mml:mi mathvariant=
"italic">y
</mml:mi>
107 Viewport width and height are silently clamped
108 to a range that depends on the implementation.
109 To query this range, call
<a href=
"glGet.xml"><span class=
"citerefentry"><span class=
"refentrytitle">glGet
</span></span></a> with argument
110 <code class=
"constant">GL_MAX_VIEWPORT_DIMS
</code>.
111 </p></div><div class=
"refsect1" lang=
"en" xml:
lang=
"en"><a id=
"errors"></a><h2>Errors
</h2><p>
112 <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 </p></div><div class=
"refsect1" lang=
"en" xml:
lang=
"en"><a id=
"associatedgets"></a><h2>Associated Gets
</h2><p>
114 <a href=
"glGet.xml"><span class=
"citerefentry"><span class=
"refentrytitle">glGet
</span></span></a> with argument
<code class=
"constant">GL_VIEWPORT
</code>
116 <a href=
"glGet.xml"><span class=
"citerefentry"><span class=
"refentrytitle">glGet
</span></span></a> with argument
<code class=
"constant">GL_MAX_VIEWPORT_DIMS
</code>
117 </p></div><div class=
"refsect1" lang=
"en" xml:
lang=
"en"><a id=
"seealso"></a><h2>See Also
</h2><p>
118 <a href=
"glDepthRange.xml"><span class=
"citerefentry"><span class=
"refentrytitle">glDepthRange
</span></span></a>
119 </p></div><div class=
"refsect1" lang=
"en" xml:
lang=
"en"><a id=
"Copyright"></a><h2>Copyright
</h2><p>
120 Copyright
<span class=
"trademark"></span>©
1991-
2006
121 Silicon Graphics, Inc. This document is licensed under the SGI
122 Free Software B License. For details, see
123 <a href=
"http://oss.sgi.com/projects/FreeB/" target=
"_top">http://oss.sgi.com/projects/FreeB/
</a>.
124 </p></div></div></body></html>