rename upstream-man-pages to upstream-doc
[clinton/guile-figl.git] / upstream-doc / man2 / xhtml / glViewport.xml
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
8 of the viewport.
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
11 window.
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>
15 and
16 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">y</mml:mi></mml:math>
17 from
18 normalized device coordinates to window coordinates.
19 Let
20 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
21
22 <mml:mfenced open="(" close=")">
23 <mml:msub><mml:mi mathvariant="italic">x</mml:mi>
24 <mml:mi mathvariant="italic">nd</mml:mi>
25 </mml:msub>
26 <mml:msub><mml:mi mathvariant="italic">y</mml:mi>
27 <mml:mi mathvariant="italic">nd</mml:mi>
28 </mml:msub>
29 </mml:mfenced>
30 </mml:math>
31 be normalized device coordinates.
32 Then the window coordinates
33 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
34
35 <mml:mfenced open="(" close=")">
36 <mml:msub><mml:mi mathvariant="italic">x</mml:mi>
37 <mml:mi mathvariant="italic">w</mml:mi>
38 </mml:msub>
39 <mml:msub><mml:mi mathvariant="italic">y</mml:mi>
40 <mml:mi mathvariant="italic">w</mml:mi>
41 </mml:msub>
42 </mml:mfenced>
43 </mml:math>
44 are computed as follows:
45 </p><p>
46 </p><div class="informalequation"><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
47
48 <mml:mrow>
49 <mml:msub><mml:mi mathvariant="italic">x</mml:mi>
50 <mml:mi mathvariant="italic">w</mml:mi>
51 </mml:msub>
52 <mml:mo>=</mml:mo>
53 <mml:mrow>
54 <mml:mfenced open="(" close=")">
55 <mml:mrow>
56 <mml:msub><mml:mi mathvariant="italic">x</mml:mi>
57 <mml:mi mathvariant="italic">nd</mml:mi>
58 </mml:msub>
59 <mml:mo>+</mml:mo>
60 <mml:mn>1</mml:mn>
61 </mml:mrow>
62 </mml:mfenced>
63 <mml:mo></mml:mo>
64 <mml:mfenced open="(" close=")">
65 <mml:mfrac>
66 <mml:mi mathvariant="italic">width</mml:mi>
67 <mml:mn>2</mml:mn>
68 </mml:mfrac>
69 </mml:mfenced>
70 <mml:mo>+</mml:mo>
71 <mml:mi mathvariant="italic">x</mml:mi>
72 </mml:mrow>
73 </mml:mrow>
74 </mml:math></div><p>
75 </p><p>
76 </p><div class="informalequation"><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
77
78 <mml:mrow>
79 <mml:msub><mml:mi mathvariant="italic">y</mml:mi>
80 <mml:mi mathvariant="italic">w</mml:mi>
81 </mml:msub>
82 <mml:mo>=</mml:mo>
83 <mml:mrow>
84 <mml:mfenced open="(" close=")">
85 <mml:mrow>
86 <mml:msub><mml:mi mathvariant="italic">y</mml:mi>
87 <mml:mi mathvariant="italic">nd</mml:mi>
88 </mml:msub>
89 <mml:mo>+</mml:mo>
90 <mml:mn>1</mml:mn>
91 </mml:mrow>
92 </mml:mfenced>
93 <mml:mo></mml:mo>
94 <mml:mfenced open="(" close=")">
95 <mml:mfrac>
96 <mml:mi mathvariant="italic">height</mml:mi>
97 <mml:mn>2</mml:mn>
98 </mml:mfrac>
99 </mml:mfenced>
100 <mml:mo>+</mml:mo>
101 <mml:mi mathvariant="italic">y</mml:mi>
102 </mml:mrow>
103 </mml:mrow>
104 </mml:math></div><p>
105 </p><p>
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.
112 </p><p>
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>
118 </p><p>
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>