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">
4 <refentry id=
"glViewportArray">
9 <holder>Khronos Group
</holder>
12 <refentrytitle>glViewportArray
</refentrytitle>
13 <manvolnum>3G
</manvolnum>
16 <refname>glViewportArray
</refname>
17 <refpurpose>set multiple viewports
</refpurpose>
19 <refsynopsisdiv><title>C Specification
</title>
22 <funcdef>void
<function>glViewportArrayv
</function></funcdef>
23 <paramdef>GLuint
<parameter>first
</parameter></paramdef>
24 <paramdef>GLsizei
<parameter>count
</parameter></paramdef>
25 <paramdef>const GLfloat *
<parameter>v
</parameter></paramdef>
29 <!-- eqn: ignoring delim $$ -->
30 <refsect1 id=
"parameters"><title>Parameters
</title>
33 <term><parameter>first
</parameter></term>
36 Specify the first viewport to set.
41 <term><parameter>count
</parameter></term>
44 Specify the number of viewports to set.
49 <term><parameter>v
</parameter></term>
52 Specify the address of an array containing the viewport parameters.
58 <refsect1 id=
"description"><title>Description
</title>
60 <function>glViewportArrayv
</function> specifies the parameters for multiple viewports
61 simulataneously.
<parameter>first
</parameter> specifies the index of the first viewport
62 to modify and
<parameter>count
</parameter> specifies the number of viewports to modify.
63 <parameter>first
</parameter> must be less than the value of
<constant>GL_MAX_VIEWPORTS
</constant>,
64 and
<parameter>first
</parameter> +
<parameter>count
</parameter> must be less than or equal to
65 the value of
<constant>GL_MAX_VIEWPORTS
</constant>. Viewports whose indices lie outside
66 the range [
<parameter>first
</parameter>,
<parameter>first
</parameter> +
<parameter>count
</parameter>)
67 are not modified.
<parameter>v
</parameter> contains the address of an array of floating
68 point values specifying the
69 left (
<inlineequation><mml:math><mml:mi mathvariant=
"italic">x
</mml:mi></mml:math></inlineequation>),
70 bottom (
<inlineequation><mml:math><mml:mi mathvariant=
"italic">y
</mml:mi></mml:math></inlineequation>),
71 width (
<inlineequation><mml:math><mml:mi mathvariant=
"italic">w
</mml:mi></mml:math></inlineequation>),
72 and height (
<inlineequation><mml:math><mml:mi mathvariant=
"italic">h
</mml:mi></mml:math></inlineequation>)
73 of each viewport, in that order.
<inlineequation><mml:math><mml:mi mathvariant=
"italic">x
</mml:mi></mml:math></inlineequation>
74 and
<inlineequation><mml:math><mml:mi mathvariant=
"italic">y
</mml:mi></mml:math></inlineequation> give
75 the location of the viewport's lower left corner, and
76 <inlineequation><mml:math><mml:mi mathvariant=
"italic">w
</mml:mi></mml:math></inlineequation>
77 and
<inlineequation><mml:math><mml:mi mathvariant=
"italic">h
</mml:mi></mml:math></inlineequation>
78 give the width and height of the viewport, respectively.
79 The viewport specifies the affine transformation of
80 <inlineequation><mml:math><mml:mi mathvariant=
"italic">x
</mml:mi></mml:math></inlineequation>
82 <inlineequation><mml:math><mml:mi mathvariant=
"italic">y
</mml:mi></mml:math></inlineequation>
84 normalized device coordinates to window coordinates.
86 <inlineequation><mml:math>
87 <!-- eqn: (x sub nd, y sub nd): -->
88 <mml:mfenced open=
"(" close=
")">
89 <mml:msub><mml:mi mathvariant=
"italic">x
</mml:mi>
90 <mml:mi mathvariant=
"italic">nd
</mml:mi>
92 <mml:msub><mml:mi mathvariant=
"italic">y
</mml:mi>
93 <mml:mi mathvariant=
"italic">nd
</mml:mi>
96 </mml:math></inlineequation>
97 be normalized device coordinates.
98 Then the window coordinates
99 <inlineequation><mml:math>
100 <!-- eqn: (x sub w, y sub w): -->
101 <mml:mfenced open=
"(" close=
")">
102 <mml:msub><mml:mi mathvariant=
"italic">x
</mml:mi>
103 <mml:mi mathvariant=
"italic">w
</mml:mi>
105 <mml:msub><mml:mi mathvariant=
"italic">y
</mml:mi>
106 <mml:mi mathvariant=
"italic">w
</mml:mi>
109 </mml:math></inlineequation>
110 are computed as follows:
113 <informalequation><mml:math>
114 <!-- eqn: x sub w = ( x sub nd + 1 ) left ( width over 2 right ) + x: -->
116 <mml:msub><mml:mi mathvariant=
"italic">x
</mml:mi>
117 <mml:mi mathvariant=
"italic">w
</mml:mi>
121 <mml:mfenced open=
"(" close=
")">
123 <mml:msub><mml:mi mathvariant=
"italic">x
</mml:mi>
124 <mml:mi mathvariant=
"italic">nd
</mml:mi>
130 <mml:mo>⁢</mml:mo>
131 <mml:mfenced open=
"(" close=
")">
133 <mml:mi mathvariant=
"italic">width
</mml:mi>
138 <mml:mi mathvariant=
"italic">x
</mml:mi>
141 </mml:math></informalequation>
144 <informalequation><mml:math>
145 <!-- eqn: y sub w = ( y sub nd + 1 ) left ( height over 2 right ) + y: -->
147 <mml:msub><mml:mi mathvariant=
"italic">y
</mml:mi>
148 <mml:mi mathvariant=
"italic">w
</mml:mi>
152 <mml:mfenced open=
"(" close=
")">
154 <mml:msub><mml:mi mathvariant=
"italic">y
</mml:mi>
155 <mml:mi mathvariant=
"italic">nd
</mml:mi>
161 <mml:mo>⁢</mml:mo>
162 <mml:mfenced open=
"(" close=
")">
164 <mml:mi mathvariant=
"italic">height
</mml:mi>
169 <mml:mi mathvariant=
"italic">y
</mml:mi>
172 </mml:math></informalequation>
175 The location of the viewport's bottom left corner, given by
176 (
<inlineequation><mml:math><mml:mi mathvariant=
"italic">x
</mml:mi></mml:math></inlineequation>,
<inlineequation><mml:math><mml:mi mathvariant=
"italic">y
</mml:mi></mml:math></inlineequation>)
177 is clamped to be within the implementaiton-dependent viewport bounds range.
178 The viewport bounds range [
<inlineequation><mml:math><mml:mi mathvariant=
"italic">min
</mml:mi></mml:math></inlineequation>,
<inlineequation><mml:math><mml:mi mathvariant=
"italic">max
</mml:mi></mml:math></inlineequation>]
179 can be determined by calling
<citerefentry><refentrytitle>glGet
</refentrytitle></citerefentry> with argument
180 <constant>GL_VIEWPORT_BOUNDS_RANGE
</constant>.
181 Viewport width and height are silently clamped
182 to a range that depends on the implementation.
183 To query this range, call
<citerefentry><refentrytitle>glGet
</refentrytitle></citerefentry> with argument
184 <constant>GL_MAX_VIEWPORT_DIMS
</constant>.
187 The precision with which the GL interprets the floating point viewport bounds is implementation-dependent
188 and may be determined by querying the impementation-defined constant
<constant>GL_VIEWPORT_SUBPIXEL_BITS
</constant>.
191 <refsect1 id=
"errors"><title>Errors
</title>
193 <constant>GL_INVALID_VALUE
</constant> is generated if
<parameter>first
</parameter> is greater than or equal to
194 the value of
<constant>GL_MAX_VIEWPORTS
</constant>.
197 <constant>GL_INVALID_VALUE
</constant> is generated if
<parameter>first
</parameter> +
<parameter>count
</parameter>
198 is greater than or equal to the value of
<constant>GL_MAX_VIEWPORTS
</constant>.
201 <constant>GL_INVALID_VALUE
</constant> is generated if either
<parameter>width
</parameter> or
<parameter>height
</parameter> is negative.
204 <refsect1 id=
"associatedgets"><title>Associated Gets
</title>
206 <citerefentry><refentrytitle>glGet
</refentrytitle></citerefentry> with argument
<constant>GL_VIEWPORT
</constant>
209 <citerefentry><refentrytitle>glGet
</refentrytitle></citerefentry> with argument
<constant>GL_MAX_VIEWPORT_DIMS
</constant>
212 <citerefentry><refentrytitle>glGet
</refentrytitle></citerefentry> with argument
<constant>GL_VIEWPORT_BOUNDS_RANGE
</constant>
215 <citerefentry><refentrytitle>glGet
</refentrytitle></citerefentry> with argument
<constant>GL_VIEWPORT_SUBPIXEL_BITS
</constant>
218 <refsect1 id=
"seealso"><title>See Also
</title>
220 <citerefentry><refentrytitle>glDepthRange
</refentrytitle></citerefentry>,
221 <citerefentry><refentrytitle>glViewport
</refentrytitle></citerefentry>,
222 <citerefentry><refentrytitle>glViewportIndexed
</refentrytitle></citerefentry>
225 <refsect1 id=
"Copyright"><title>Copyright
</title>
227 Copyright
<trademark class=
"copyright"></trademark> 2010 Khronos Group.
228 This material may be distributed subject to the terms and conditions set forth in
229 the Open Publication License, v
1.0,
8 June
1999.
230 <ulink url=
"http://opencontent.org/openpub/">http://opencontent.org/openpub/
</ulink>.