Commit | Line | Data |
---|---|---|
7faf1d71 AW |
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>glViewportIndexed - 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="glViewportIndexed"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>glViewportIndexed — set a specified 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">glViewportIndexedf</b>(</code></td><td>GLuint </td><td><var class="pdparam">index</var>, </td></tr><tr><td> </td><td>GLfloat </td><td><var class="pdparam">x</var>, </td></tr><tr><td> </td><td>GLfloat </td><td><var class="pdparam">y</var>, </td></tr><tr><td> </td><td>GLfloat </td><td><var class="pdparam">w</var>, </td></tr><tr><td> </td><td>GLfloat </td><td><var class="pdparam">h</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">glViewportIndexedfv</b>(</code></td><td>GLuint </td><td><var class="pdparam">index</var>, </td></tr><tr><td> </td><td>const GLfloat * </td><td><var class="pdparam">v</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>index</code></em></span></dt><dd><p> | |
5 | Specify the first viewport to set. | |
6 | </p></dd><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> | |
7 | For <code class="function">glViewportIndexedf</code>, specifies the lower left corner of | |
8 | the viewport rectangle, in pixels. The initial value is (0,0). | |
9 | </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> | |
10 | For <code class="function">glViewportIndexedf</code>, specifies the width and height | |
11 | of the viewport. | |
12 | When a GL context is first attached to a window, | |
13 | <em class="parameter"><code>width</code></em> and <em class="parameter"><code>height</code></em> are set to the dimensions of that | |
14 | window. | |
15 | </p></dd><dt><span class="term"><em class="parameter"><code>v</code></em></span></dt><dd><p> | |
16 | For <code class="function">glViewportIndexedfv</code>, specifies the address of an array containing the viewport parameters. | |
17 | </p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><h2>Description</h2><p> | |
18 | <code class="function">glViewportIndexedf</code> and <code class="function">glViewportIndexedfv</code> | |
19 | specify the parameters for a single viewport. | |
20 | <em class="parameter"><code>index</code></em> specifies the index of the viewport | |
21 | to modify. | |
22 | <em class="parameter"><code>index</code></em> must be less than the value of <code class="constant">GL_MAX_VIEWPORTS</code>. | |
23 | For <code class="function">glViewportIndexedf</code>, <em class="parameter"><code>x</code></em>, <em class="parameter"><code>y</code></em>, | |
24 | <em class="parameter"><code>w</code></em>, and <em class="parameter"><code>h</code></em> specify the left, bottom, width and height | |
25 | of the viewport in pixels, respectively. | |
26 | For <code class="function">glViewportIndexedfv</code>, <em class="parameter"><code>v</code></em> contains the address of an array of floating | |
27 | point values specifying the | |
28 | left (<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">x</mml:mi></mml:math>), | |
29 | bottom (<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">y</mml:mi></mml:math>), | |
30 | width (<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">w</mml:mi></mml:math>), | |
31 | and height (<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">h</mml:mi></mml:math>) | |
32 | of each viewport, in that order. <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">x</mml:mi></mml:math> | |
33 | and <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">y</mml:mi></mml:math> give | |
34 | the location of the viewport's lower left corner, and | |
35 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">w</mml:mi></mml:math> | |
36 | and <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">h</mml:mi></mml:math> | |
37 | give the width and height of the viewport, respectively. | |
38 | The viewport specifies the affine transformation of | |
39 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">x</mml:mi></mml:math> | |
40 | and | |
41 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">y</mml:mi></mml:math> | |
42 | from | |
43 | normalized device coordinates to window coordinates. | |
44 | Let | |
45 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
46 | ||
47 | <mml:mfenced open="(" close=")"> | |
48 | <mml:msub><mml:mi mathvariant="italic">x</mml:mi> | |
49 | <mml:mi mathvariant="italic">nd</mml:mi> | |
50 | </mml:msub> | |
51 | <mml:msub><mml:mi mathvariant="italic">y</mml:mi> | |
52 | <mml:mi mathvariant="italic">nd</mml:mi> | |
53 | </mml:msub> | |
54 | </mml:mfenced> | |
55 | </mml:math> | |
56 | be normalized device coordinates. | |
57 | Then the window coordinates | |
58 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
59 | ||
60 | <mml:mfenced open="(" close=")"> | |
61 | <mml:msub><mml:mi mathvariant="italic">x</mml:mi> | |
62 | <mml:mi mathvariant="italic">w</mml:mi> | |
63 | </mml:msub> | |
64 | <mml:msub><mml:mi mathvariant="italic">y</mml:mi> | |
65 | <mml:mi mathvariant="italic">w</mml:mi> | |
66 | </mml:msub> | |
67 | </mml:mfenced> | |
68 | </mml:math> | |
69 | are computed as follows: | |
70 | </p><p> | |
71 | </p><div class="informalequation"><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
72 | ||
73 | <mml:mrow> | |
74 | <mml:msub><mml:mi mathvariant="italic">x</mml:mi> | |
75 | <mml:mi mathvariant="italic">w</mml:mi> | |
76 | </mml:msub> | |
77 | <mml:mo>=</mml:mo> | |
78 | <mml:mrow> | |
79 | <mml:mfenced open="(" close=")"> | |
80 | <mml:mrow> | |
81 | <mml:msub><mml:mi mathvariant="italic">x</mml:mi> | |
82 | <mml:mi mathvariant="italic">nd</mml:mi> | |
83 | </mml:msub> | |
84 | <mml:mo>+</mml:mo> | |
85 | <mml:mn>1</mml:mn> | |
86 | </mml:mrow> | |
87 | </mml:mfenced> | |
88 | <mml:mo></mml:mo> | |
89 | <mml:mfenced open="(" close=")"> | |
90 | <mml:mfrac> | |
91 | <mml:mi mathvariant="italic">width</mml:mi> | |
92 | <mml:mn>2</mml:mn> | |
93 | </mml:mfrac> | |
94 | </mml:mfenced> | |
95 | <mml:mo>+</mml:mo> | |
96 | <mml:mi mathvariant="italic">x</mml:mi> | |
97 | </mml:mrow> | |
98 | </mml:mrow> | |
99 | </mml:math></div><p> | |
100 | </p><p> | |
101 | </p><div class="informalequation"><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> | |
102 | ||
103 | <mml:mrow> | |
104 | <mml:msub><mml:mi mathvariant="italic">y</mml:mi> | |
105 | <mml:mi mathvariant="italic">w</mml:mi> | |
106 | </mml:msub> | |
107 | <mml:mo>=</mml:mo> | |
108 | <mml:mrow> | |
109 | <mml:mfenced open="(" close=")"> | |
110 | <mml:mrow> | |
111 | <mml:msub><mml:mi mathvariant="italic">y</mml:mi> | |
112 | <mml:mi mathvariant="italic">nd</mml:mi> | |
113 | </mml:msub> | |
114 | <mml:mo>+</mml:mo> | |
115 | <mml:mn>1</mml:mn> | |
116 | </mml:mrow> | |
117 | </mml:mfenced> | |
118 | <mml:mo></mml:mo> | |
119 | <mml:mfenced open="(" close=")"> | |
120 | <mml:mfrac> | |
121 | <mml:mi mathvariant="italic">height</mml:mi> | |
122 | <mml:mn>2</mml:mn> | |
123 | </mml:mfrac> | |
124 | </mml:mfenced> | |
125 | <mml:mo>+</mml:mo> | |
126 | <mml:mi mathvariant="italic">y</mml:mi> | |
127 | </mml:mrow> | |
128 | </mml:mrow> | |
129 | </mml:math></div><p> | |
130 | </p><p> | |
131 | The location of the viewport's bottom left corner, given by | |
132 | (<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">x</mml:mi></mml:math>, <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">y</mml:mi></mml:math>) | |
133 | is clamped to be within the implementaiton-dependent viewport bounds range. | |
134 | The viewport bounds range [<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">min</mml:mi></mml:math>, <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">max</mml:mi></mml:math>] | |
135 | can be determined by calling <a href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument | |
136 | <code class="constant">GL_VIEWPORT_BOUNDS_RANGE</code>. | |
137 | Viewport width and height are silently clamped | |
138 | to a range that depends on the implementation. | |
139 | To query this range, call <a href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument | |
140 | <code class="constant">GL_MAX_VIEWPORT_DIMS</code>. | |
141 | </p><p> | |
142 | The precision with which the GL interprets the floating point viewport bounds is implementation-dependent | |
143 | and may be determined by querying the impementation-defined constant <code class="constant">GL_VIEWPORT_SUBPIXEL_BITS</code>. | |
144 | </p><p> | |
145 | Calling <code class="function">glViewportIndexedfv</code> is equivalent to calling <a href="glViewportArray.xml"><span class="citerefentry"><span class="refentrytitle">glViewportArray</span></span></a> | |
146 | with <em class="parameter"><code>first</code></em> set to <em class="parameter"><code>index</code></em>, <em class="parameter"><code>count</code></em> set to | |
147 | 1 and <em class="parameter"><code>v</code></em> passsed directly. <code class="function">glViewportIndexedf</code> is equivalent | |
148 | to: | |
149 | </p><pre class="programlisting"> void glViewportIndexedf(GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h) | |
150 | { | |
151 | const float v[4] = { x, y, w, h }; | |
152 | glViewportArrayv(index, 1, v); | |
153 | }</pre></div><div class="refsect1" lang="en" xml:lang="en"><a id="errors"></a><h2>Errors</h2><p> | |
154 | <code class="constant">GL_INVALID_VALUE</code> is generated if <em class="parameter"><code>index</code></em> is greater than or equal to | |
155 | the value of <code class="constant">GL_MAX_VIEWPORTS</code>. | |
156 | </p><p> | |
157 | <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. | |
158 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="associatedgets"></a><h2>Associated Gets</h2><p> | |
159 | <a href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_VIEWPORT</code> | |
160 | </p><p> | |
161 | <a href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_MAX_VIEWPORT_DIMS</code> | |
162 | </p><p> | |
163 | <a href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_VIEWPORT_BOUNDS_RANGE</code> | |
164 | </p><p> | |
165 | <a href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_VIEWPORT_SUBPIXEL_BITS</code> | |
166 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="seealso"></a><h2>See Also</h2><p> | |
167 | <a href="glDepthRange.xml"><span class="citerefentry"><span class="refentrytitle">glDepthRange</span></span></a>, | |
168 | <a href="glViewport.xml"><span class="citerefentry"><span class="refentrytitle">glViewport</span></span></a>, | |
169 | <a href="glViewportArray.xml"><span class="citerefentry"><span class="refentrytitle">glViewportArray</span></span></a> | |
170 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="Copyright"></a><h2>Copyright</h2><p> | |
171 | Copyright <span class="trademark"></span>© 2010 Khronos Group. | |
172 | This material may be distributed subject to the terms and conditions set forth in | |
173 | the Open Publication License, v 1.0, 8 June 1999. | |
174 | <a href="http://opencontent.org/openpub/" target="_top">http://opencontent.org/openpub/</a>. | |
175 | </p></div></div></body></html> |