2014-03-28 19:06:55 +00:00
|
|
|
<!DOCTYPE refentry [ <!ENTITY % mathent SYSTEM "math.ent"> %mathent; ]>
|
|
|
|
|
|
|
|
<!-- Converted by db4-upgrade version 1.1 -->
|
|
|
|
|
|
|
|
<refentry xmlns="http://docbook.org/ns/docbook" version="5.0" xml:id="glViewport">
|
|
|
|
<info>
|
2013-11-03 11:43:50 +00:00
|
|
|
<copyright>
|
|
|
|
<year>1991-2006</year>
|
|
|
|
<holder>Silicon Graphics, Inc.</holder>
|
|
|
|
</copyright>
|
2013-12-15 21:32:32 +00:00
|
|
|
<copyright>
|
|
|
|
<year>2010-2013</year>
|
|
|
|
<holder>Khronos Group</holder>
|
|
|
|
</copyright>
|
2014-03-28 19:06:55 +00:00
|
|
|
</info>
|
2009-03-08 00:46:58 +00:00
|
|
|
<refmeta>
|
|
|
|
<refentrytitle>glViewport</refentrytitle>
|
|
|
|
<manvolnum>3G</manvolnum>
|
|
|
|
</refmeta>
|
|
|
|
<refnamediv>
|
|
|
|
<refname>glViewport</refname>
|
|
|
|
<refpurpose>set the viewport</refpurpose>
|
|
|
|
</refnamediv>
|
|
|
|
<refsynopsisdiv><title>C Specification</title>
|
|
|
|
<funcsynopsis>
|
|
|
|
<funcprototype>
|
|
|
|
<funcdef>void <function>glViewport</function></funcdef>
|
|
|
|
<paramdef>GLint <parameter>x</parameter></paramdef>
|
|
|
|
<paramdef>GLint <parameter>y</parameter></paramdef>
|
|
|
|
<paramdef>GLsizei <parameter>width</parameter></paramdef>
|
|
|
|
<paramdef>GLsizei <parameter>height</parameter></paramdef>
|
|
|
|
</funcprototype>
|
|
|
|
</funcsynopsis>
|
|
|
|
</refsynopsisdiv>
|
2014-03-28 19:06:55 +00:00
|
|
|
<refsect1 xml:id="parameters"><title>Parameters</title>
|
2009-03-08 00:46:58 +00:00
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>x</parameter></term>
|
|
|
|
<term><parameter>y</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Specify the lower left corner of the viewport rectangle,
|
|
|
|
in pixels. The initial value is (0,0).
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>width</parameter></term>
|
|
|
|
<term><parameter>height</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Specify the width and height
|
|
|
|
of the viewport.
|
|
|
|
When a GL context is first attached to a window,
|
|
|
|
<parameter>width</parameter> and <parameter>height</parameter> are set to the dimensions of that
|
|
|
|
window.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
</refsect1>
|
2014-03-28 19:06:55 +00:00
|
|
|
<refsect1 xml:id="description"><title>Description</title>
|
2009-03-08 00:46:58 +00:00
|
|
|
<para>
|
2013-11-03 11:43:50 +00:00
|
|
|
<function>glViewport</function> specifies the affine transformation of
|
2014-03-28 19:06:55 +00:00
|
|
|
<inlineequation><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">x</mml:mi></mml:math></inlineequation>
|
2013-11-03 11:43:50 +00:00
|
|
|
and
|
2014-03-28 19:06:55 +00:00
|
|
|
<inlineequation><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">y</mml:mi></mml:math></inlineequation>
|
2009-03-08 00:46:58 +00:00
|
|
|
from
|
|
|
|
normalized device coordinates to window coordinates.
|
2013-11-03 11:43:50 +00:00
|
|
|
Let
|
2014-03-28 19:06:55 +00:00
|
|
|
<inlineequation><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
|
2009-03-08 00:46:58 +00:00
|
|
|
<!-- eqn: (x sub nd, y sub nd):-->
|
|
|
|
<mml:mfenced open="(" close=")">
|
|
|
|
<mml:msub><mml:mi mathvariant="italic">x</mml:mi>
|
|
|
|
<mml:mi mathvariant="italic">nd</mml:mi>
|
|
|
|
</mml:msub>
|
|
|
|
<mml:msub><mml:mi mathvariant="italic">y</mml:mi>
|
|
|
|
<mml:mi mathvariant="italic">nd</mml:mi>
|
|
|
|
</mml:msub>
|
|
|
|
</mml:mfenced>
|
|
|
|
</mml:math></inlineequation>
|
|
|
|
be normalized device coordinates.
|
2013-11-03 11:43:50 +00:00
|
|
|
Then the window coordinates
|
2014-03-28 19:06:55 +00:00
|
|
|
<inlineequation><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
|
2009-03-08 00:46:58 +00:00
|
|
|
<!-- eqn: (x sub w, y sub w):-->
|
|
|
|
<mml:mfenced open="(" close=")">
|
|
|
|
<mml:msub><mml:mi mathvariant="italic">x</mml:mi>
|
|
|
|
<mml:mi mathvariant="italic">w</mml:mi>
|
|
|
|
</mml:msub>
|
|
|
|
<mml:msub><mml:mi mathvariant="italic">y</mml:mi>
|
|
|
|
<mml:mi mathvariant="italic">w</mml:mi>
|
|
|
|
</mml:msub>
|
|
|
|
</mml:mfenced>
|
|
|
|
</mml:math></inlineequation>
|
|
|
|
are computed as follows:
|
|
|
|
</para>
|
|
|
|
<para>
|
2014-03-28 19:06:55 +00:00
|
|
|
<informalequation><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
|
2009-03-08 00:46:58 +00:00
|
|
|
<!-- eqn: x sub w = ( x sub nd + 1 ) left ( width over 2 right ) + x:-->
|
|
|
|
<mml:mrow>
|
|
|
|
<mml:msub><mml:mi mathvariant="italic">x</mml:mi>
|
|
|
|
<mml:mi mathvariant="italic">w</mml:mi>
|
|
|
|
</mml:msub>
|
|
|
|
<mml:mo>=</mml:mo>
|
|
|
|
<mml:mrow>
|
|
|
|
<mml:mfenced open="(" close=")">
|
|
|
|
<mml:mrow>
|
|
|
|
<mml:msub><mml:mi mathvariant="italic">x</mml:mi>
|
|
|
|
<mml:mi mathvariant="italic">nd</mml:mi>
|
|
|
|
</mml:msub>
|
|
|
|
<mml:mo>+</mml:mo>
|
|
|
|
<mml:mn>1</mml:mn>
|
|
|
|
</mml:mrow>
|
|
|
|
</mml:mfenced>
|
|
|
|
<mml:mo>⁢</mml:mo>
|
|
|
|
<mml:mfenced open="(" close=")">
|
|
|
|
<mml:mfrac>
|
|
|
|
<mml:mi mathvariant="italic">width</mml:mi>
|
|
|
|
<mml:mn>2</mml:mn>
|
|
|
|
</mml:mfrac>
|
|
|
|
</mml:mfenced>
|
|
|
|
<mml:mo>+</mml:mo>
|
|
|
|
<mml:mi mathvariant="italic">x</mml:mi>
|
|
|
|
</mml:mrow>
|
|
|
|
</mml:mrow>
|
|
|
|
</mml:math></informalequation>
|
|
|
|
</para>
|
|
|
|
<para>
|
2014-03-28 19:06:55 +00:00
|
|
|
<informalequation><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
|
2009-03-08 00:46:58 +00:00
|
|
|
<!-- eqn: y sub w = ( y sub nd + 1 ) left ( height over 2 right ) + y:-->
|
|
|
|
<mml:mrow>
|
|
|
|
<mml:msub><mml:mi mathvariant="italic">y</mml:mi>
|
|
|
|
<mml:mi mathvariant="italic">w</mml:mi>
|
|
|
|
</mml:msub>
|
|
|
|
<mml:mo>=</mml:mo>
|
|
|
|
<mml:mrow>
|
|
|
|
<mml:mfenced open="(" close=")">
|
|
|
|
<mml:mrow>
|
|
|
|
<mml:msub><mml:mi mathvariant="italic">y</mml:mi>
|
|
|
|
<mml:mi mathvariant="italic">nd</mml:mi>
|
|
|
|
</mml:msub>
|
|
|
|
<mml:mo>+</mml:mo>
|
|
|
|
<mml:mn>1</mml:mn>
|
|
|
|
</mml:mrow>
|
|
|
|
</mml:mfenced>
|
|
|
|
<mml:mo>⁢</mml:mo>
|
|
|
|
<mml:mfenced open="(" close=")">
|
|
|
|
<mml:mfrac>
|
|
|
|
<mml:mi mathvariant="italic">height</mml:mi>
|
|
|
|
<mml:mn>2</mml:mn>
|
|
|
|
</mml:mfrac>
|
|
|
|
</mml:mfenced>
|
|
|
|
<mml:mo>+</mml:mo>
|
|
|
|
<mml:mi mathvariant="italic">y</mml:mi>
|
|
|
|
</mml:mrow>
|
|
|
|
</mml:mrow>
|
|
|
|
</mml:math></informalequation>
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
Viewport width and height are silently clamped
|
|
|
|
to a range that depends on the implementation.
|
|
|
|
To query this range, call <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument
|
|
|
|
<constant>GL_MAX_VIEWPORT_DIMS</constant>.
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
2014-03-28 19:06:55 +00:00
|
|
|
<refsect1 xml:id="errors"><title>Errors</title>
|
2009-03-08 00:46:58 +00:00
|
|
|
<para>
|
|
|
|
<constant>GL_INVALID_VALUE</constant> is generated if either <parameter>width</parameter> or <parameter>height</parameter> is negative.
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
2014-03-28 19:06:55 +00:00
|
|
|
<refsect1 xml:id="associatedgets"><title>Associated Gets</title>
|
2009-03-08 00:46:58 +00:00
|
|
|
<para>
|
|
|
|
<citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_VIEWPORT</constant>
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
<citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_MAX_VIEWPORT_DIMS</constant>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
2014-03-28 19:06:55 +00:00
|
|
|
<refsect1 xml:id="seealso"><title>See Also</title>
|
2009-03-08 00:46:58 +00:00
|
|
|
<para>
|
|
|
|
<citerefentry><refentrytitle>glDepthRange</refentrytitle></citerefentry>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
2014-03-28 19:06:55 +00:00
|
|
|
<refsect1 xml:id="Copyright"><title>Copyright</title>
|
2009-03-08 00:46:58 +00:00
|
|
|
<para>
|
2014-03-28 19:06:55 +00:00
|
|
|
Copyright <trademark class="copyright"/> 1991-2006 Silicon Graphics, Inc.
|
|
|
|
Copyright <trademark class="copyright"/> 2010-2013 Khronos Group.
|
2013-12-15 21:32:32 +00:00
|
|
|
This document is licensed under the SGI Free Software B License.
|
|
|
|
For details, see
|
2014-03-28 19:06:55 +00:00
|
|
|
<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/</link>.
|
2009-03-08 00:46:58 +00:00
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
</refentry>
|