420 lines
20 KiB
XML
420 lines
20 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook MathML Module V1.1b1//EN"
|
|
"http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd">
|
|
<refentry id="glFrustum">
|
|
<refmeta>
|
|
<refmetainfo>
|
|
<copyright>
|
|
<year>1991-2006</year>
|
|
<holder>Silicon Graphics, Inc.</holder>
|
|
</copyright>
|
|
</refmetainfo>
|
|
<refentrytitle>glFrustum</refentrytitle>
|
|
<manvolnum>3G</manvolnum>
|
|
</refmeta>
|
|
<refnamediv>
|
|
<refname>glFrustum</refname>
|
|
<refpurpose>multiply the current matrix by a perspective matrix</refpurpose>
|
|
</refnamediv>
|
|
<refsynopsisdiv><title>C Specification</title>
|
|
<funcsynopsis>
|
|
<funcprototype>
|
|
<funcdef>void <function>glFrustum</function></funcdef>
|
|
<paramdef>GLdouble <parameter>left</parameter></paramdef>
|
|
<paramdef>GLdouble <parameter>right</parameter></paramdef>
|
|
<paramdef>GLdouble <parameter>bottom</parameter></paramdef>
|
|
<paramdef>GLdouble <parameter>top</parameter></paramdef>
|
|
<paramdef>GLdouble <parameter>nearVal</parameter></paramdef>
|
|
<paramdef>GLdouble <parameter>farVal</parameter></paramdef>
|
|
</funcprototype>
|
|
</funcsynopsis>
|
|
</refsynopsisdiv>
|
|
<!-- eqn: ignoring delim $$ -->
|
|
<refsect1 id="parameters"><title>Parameters</title>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>left</parameter></term>
|
|
<term><parameter>right</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Specify the coordinates for the left and right vertical clipping planes.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>bottom</parameter></term>
|
|
<term><parameter>top</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Specify the coordinates for the bottom and top horizontal clipping planes.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>nearVal</parameter></term>
|
|
<term><parameter>farVal</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Specify the distances to the near and far depth clipping planes.
|
|
Both distances must be positive.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</refsect1>
|
|
<refsect1 id="description"><title>Description</title>
|
|
<para>
|
|
<function>glFrustum</function> describes a perspective matrix that produces a perspective projection.
|
|
The current matrix (see <citerefentry><refentrytitle>glMatrixMode</refentrytitle></citerefentry>) is multiplied by this matrix
|
|
and the result replaces the current matrix, as if
|
|
<citerefentry><refentrytitle>glMultMatrix</refentrytitle></citerefentry> were called with the following matrix
|
|
as its argument:
|
|
</para>
|
|
<para>
|
|
</para>
|
|
<para>
|
|
<informalequation><mml:math>
|
|
<!-- eqn: left [ matrix { ccol { {{2 nearVal} over {right - left}} above 0 above 0 above 0 } ccol { 0 above {{2 nearVal} over {top - bottom}} above 0 above 0 } ccol { A above B above C above -1 } ccol { 0 above 0 above D above 0} } right ]:-->
|
|
<mml:mfenced open="[" close="]">
|
|
<mml:mtable>
|
|
<mml:mtr>
|
|
<mml:mtd>
|
|
<mml:mfenced open="" close="">
|
|
<mml:mfrac>
|
|
<mml:mfenced open="" close="">
|
|
<mml:mrow>
|
|
<mml:mn>2</mml:mn>
|
|
<mml:mo>⁢</mml:mo>
|
|
<mml:mi mathvariant="italic">nearVal</mml:mi>
|
|
</mml:mrow>
|
|
</mml:mfenced>
|
|
<mml:mfenced open="" close="">
|
|
<mml:mrow>
|
|
<mml:mi mathvariant="italic">right</mml:mi>
|
|
<mml:mo>-</mml:mo>
|
|
<mml:mi mathvariant="italic">left</mml:mi>
|
|
</mml:mrow>
|
|
</mml:mfenced>
|
|
</mml:mfrac>
|
|
</mml:mfenced>
|
|
</mml:mtd>
|
|
<mml:mtd>
|
|
<mml:mn>0</mml:mn>
|
|
</mml:mtd>
|
|
<mml:mtd>
|
|
<mml:mi mathvariant="italic">A</mml:mi>
|
|
</mml:mtd>
|
|
<mml:mtd>
|
|
<mml:mn>0</mml:mn>
|
|
</mml:mtd>
|
|
</mml:mtr>
|
|
<mml:mtr>
|
|
<mml:mtd>
|
|
<mml:mn>0</mml:mn>
|
|
</mml:mtd>
|
|
<mml:mtd>
|
|
<mml:mfenced open="" close="">
|
|
<mml:mfrac>
|
|
<mml:mfenced open="" close="">
|
|
<mml:mrow>
|
|
<mml:mn>2</mml:mn>
|
|
<mml:mo>⁢</mml:mo>
|
|
<mml:mi mathvariant="italic">nearVal</mml:mi>
|
|
</mml:mrow>
|
|
</mml:mfenced>
|
|
<mml:mfenced open="" close="">
|
|
<mml:mrow>
|
|
<mml:mi mathvariant="italic">top</mml:mi>
|
|
<mml:mo>-</mml:mo>
|
|
<mml:mi mathvariant="italic">bottom</mml:mi>
|
|
</mml:mrow>
|
|
</mml:mfenced>
|
|
</mml:mfrac>
|
|
</mml:mfenced>
|
|
</mml:mtd>
|
|
<mml:mtd>
|
|
<mml:mi mathvariant="italic">B</mml:mi>
|
|
</mml:mtd>
|
|
<mml:mtd>
|
|
<mml:mn>0</mml:mn>
|
|
</mml:mtd>
|
|
</mml:mtr>
|
|
<mml:mtr>
|
|
<mml:mtd>
|
|
<mml:mn>0</mml:mn>
|
|
</mml:mtd>
|
|
<mml:mtd>
|
|
<mml:mn>0</mml:mn>
|
|
</mml:mtd>
|
|
<mml:mtd>
|
|
<mml:mi mathvariant="italic">C</mml:mi>
|
|
</mml:mtd>
|
|
<mml:mtd>
|
|
<mml:mi mathvariant="italic">D</mml:mi>
|
|
</mml:mtd>
|
|
</mml:mtr>
|
|
<mml:mtr>
|
|
<mml:mtd>
|
|
<mml:mn>0</mml:mn>
|
|
</mml:mtd>
|
|
<mml:mtd>
|
|
<mml:mn>0</mml:mn>
|
|
</mml:mtd>
|
|
<mml:mtd>
|
|
<mml:mn>-1</mml:mn>
|
|
</mml:mtd>
|
|
<mml:mtd>
|
|
<mml:mn>0</mml:mn>
|
|
</mml:mtd>
|
|
</mml:mtr>
|
|
</mml:mtable>
|
|
</mml:mfenced>
|
|
</mml:math></informalequation>
|
|
</para>
|
|
<para>
|
|
<informalequation><mml:math>
|
|
<!-- eqn: A = {right + left} over {right - left}:-->
|
|
<mml:mrow>
|
|
<mml:mi mathvariant="italic">A</mml:mi>
|
|
<mml:mo>=</mml:mo>
|
|
<mml:mfrac>
|
|
<mml:mfenced open="" close="">
|
|
<mml:mrow>
|
|
<mml:mi mathvariant="italic">right</mml:mi>
|
|
<mml:mo>+</mml:mo>
|
|
<mml:mi mathvariant="italic">left</mml:mi>
|
|
</mml:mrow>
|
|
</mml:mfenced>
|
|
<mml:mfenced open="" close="">
|
|
<mml:mrow>
|
|
<mml:mi mathvariant="italic">right</mml:mi>
|
|
<mml:mo>-</mml:mo>
|
|
<mml:mi mathvariant="italic">left</mml:mi>
|
|
</mml:mrow>
|
|
</mml:mfenced>
|
|
</mml:mfrac>
|
|
</mml:mrow>
|
|
</mml:math></informalequation>
|
|
</para>
|
|
<para>
|
|
<informalequation><mml:math>
|
|
<!-- eqn: B = {top + bottom} over {top - bottom}:-->
|
|
<mml:mrow>
|
|
<mml:mi mathvariant="italic">B</mml:mi>
|
|
<mml:mo>=</mml:mo>
|
|
<mml:mfrac>
|
|
<mml:mfenced open="" close="">
|
|
<mml:mrow>
|
|
<mml:mi mathvariant="italic">top</mml:mi>
|
|
<mml:mo>+</mml:mo>
|
|
<mml:mi mathvariant="italic">bottom</mml:mi>
|
|
</mml:mrow>
|
|
</mml:mfenced>
|
|
<mml:mfenced open="" close="">
|
|
<mml:mrow>
|
|
<mml:mi mathvariant="italic">top</mml:mi>
|
|
<mml:mo>-</mml:mo>
|
|
<mml:mi mathvariant="italic">bottom</mml:mi>
|
|
</mml:mrow>
|
|
</mml:mfenced>
|
|
</mml:mfrac>
|
|
</mml:mrow>
|
|
</mml:math></informalequation>
|
|
</para>
|
|
<para>
|
|
<informalequation><mml:math>
|
|
<!-- eqn: C = -{{farVal + nearVal} over {farVal - nearVal}}:-->
|
|
<mml:mrow>
|
|
<mml:mi mathvariant="italic">C</mml:mi>
|
|
<mml:mo>=</mml:mo>
|
|
<mml:mrow>
|
|
<mml:mo>-</mml:mo>
|
|
<mml:mfenced open="" close="">
|
|
<mml:mfrac>
|
|
<mml:mfenced open="" close="">
|
|
<mml:mrow>
|
|
<mml:mi mathvariant="italic">farVal</mml:mi>
|
|
<mml:mo>+</mml:mo>
|
|
<mml:mi mathvariant="italic">nearVal</mml:mi>
|
|
</mml:mrow>
|
|
</mml:mfenced>
|
|
<mml:mfenced open="" close="">
|
|
<mml:mrow>
|
|
<mml:mi mathvariant="italic">farVal</mml:mi>
|
|
<mml:mo>-</mml:mo>
|
|
<mml:mi mathvariant="italic">nearVal</mml:mi>
|
|
</mml:mrow>
|
|
</mml:mfenced>
|
|
</mml:mfrac>
|
|
</mml:mfenced>
|
|
</mml:mrow>
|
|
</mml:mrow>
|
|
</mml:math></informalequation>
|
|
</para>
|
|
<para>
|
|
<informalequation><mml:math>
|
|
<!-- eqn: D = -{{2 farVal nearVal} over {farVal - nearVal}}:-->
|
|
<mml:mrow>
|
|
<mml:mi mathvariant="italic">D</mml:mi>
|
|
<mml:mo>=</mml:mo>
|
|
<mml:mrow>
|
|
<mml:mo>-</mml:mo>
|
|
<mml:mfenced open="" close="">
|
|
<mml:mfrac>
|
|
<mml:mfenced open="" close="">
|
|
<mml:mrow>
|
|
<mml:mn>2</mml:mn>
|
|
<mml:mo>⁢</mml:mo>
|
|
<mml:mi mathvariant="italic">farVal</mml:mi>
|
|
<mml:mo>⁢</mml:mo>
|
|
<mml:mi mathvariant="italic">nearVal</mml:mi>
|
|
</mml:mrow>
|
|
</mml:mfenced>
|
|
<mml:mfenced open="" close="">
|
|
<mml:mrow>
|
|
<mml:mi mathvariant="italic">farVal</mml:mi>
|
|
<mml:mo>-</mml:mo>
|
|
<mml:mi mathvariant="italic">nearVal</mml:mi>
|
|
</mml:mrow>
|
|
</mml:mfenced>
|
|
</mml:mfrac>
|
|
</mml:mfenced>
|
|
</mml:mrow>
|
|
</mml:mrow>
|
|
</mml:math></informalequation>
|
|
</para>
|
|
<para>
|
|
</para>
|
|
<para>
|
|
Typically, the matrix mode is <constant>GL_PROJECTION</constant>, and
|
|
<inlineequation><mml:math>
|
|
<!-- eqn: (left, bottom, -nearVal):-->
|
|
<mml:mfenced open="(" close=")">
|
|
<mml:mi mathvariant="italic">left</mml:mi>
|
|
<mml:mi mathvariant="italic">bottom</mml:mi>
|
|
<mml:mrow>
|
|
<mml:mo>-</mml:mo>
|
|
<mml:mi mathvariant="italic">nearVal</mml:mi>
|
|
</mml:mrow>
|
|
</mml:mfenced>
|
|
</mml:math></inlineequation>
|
|
and
|
|
<inlineequation><mml:math>
|
|
<!-- eqn: (right, top, -nearVal):-->
|
|
<mml:mfenced open="(" close=")">
|
|
<mml:mi mathvariant="italic">right</mml:mi>
|
|
<mml:mi mathvariant="italic">top</mml:mi>
|
|
<mml:mrow>
|
|
<mml:mo>-</mml:mo>
|
|
<mml:mi mathvariant="italic">nearVal</mml:mi>
|
|
</mml:mrow>
|
|
</mml:mfenced>
|
|
</mml:math></inlineequation>
|
|
specify the points on the near clipping plane that are mapped
|
|
to the lower left and upper right corners of the window,
|
|
assuming that the eye is located at (0, 0, 0).
|
|
<inlineequation><mml:math>
|
|
<!-- eqn: -farVal:-->
|
|
<mml:mrow>
|
|
<mml:mo>-</mml:mo>
|
|
<mml:mi mathvariant="italic">farVal</mml:mi>
|
|
</mml:mrow>
|
|
</mml:math></inlineequation>
|
|
specifies the location of the far clipping plane.
|
|
Both <parameter>nearVal</parameter> and <parameter>farVal</parameter> must be positive.
|
|
</para>
|
|
<para>
|
|
Use <citerefentry><refentrytitle>glPushMatrix</refentrytitle></citerefentry> and <citerefentry><refentrytitle>glPopMatrix</refentrytitle></citerefentry> to save and restore
|
|
the current matrix stack.
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 id="notes"><title>Notes</title>
|
|
<para>
|
|
Depth buffer precision is affected by the values specified for
|
|
<parameter>nearVal</parameter> and <parameter>farVal</parameter>.
|
|
The greater the ratio of <parameter>farVal</parameter> to <parameter>nearVal</parameter> is,
|
|
the less effective the depth buffer will be at distinguishing between
|
|
surfaces that are near each other.
|
|
If
|
|
</para>
|
|
<para>
|
|
<inlineequation><mml:math>
|
|
<!-- eqn: r = farVal over nearVal:-->
|
|
<mml:mrow>
|
|
<mml:mi mathvariant="italic">r</mml:mi>
|
|
<mml:mo>=</mml:mo>
|
|
<mml:mfrac>
|
|
<mml:mi mathvariant="italic">farVal</mml:mi>
|
|
<mml:mi mathvariant="italic">nearVal</mml:mi>
|
|
</mml:mfrac>
|
|
</mml:mrow>
|
|
</mml:math></inlineequation>
|
|
</para>
|
|
<para>
|
|
roughly
|
|
<inlineequation><mml:math>
|
|
<!-- eqn: log sub 2 (r):-->
|
|
<mml:mrow>
|
|
<mml:msub><mml:mi mathvariant="italic">log</mml:mi>
|
|
<mml:mn>2</mml:mn>
|
|
</mml:msub>
|
|
<mml:mo>⁡</mml:mo>
|
|
<mml:mfenced open="(" close=")">
|
|
<mml:mi mathvariant="italic">r</mml:mi>
|
|
</mml:mfenced>
|
|
</mml:mrow>
|
|
</mml:math></inlineequation>
|
|
bits of depth buffer precision are lost.
|
|
Because
|
|
<inlineequation><mml:math><mml:mi mathvariant="italic">r</mml:mi></mml:math></inlineequation>
|
|
approaches infinity as <parameter>nearVal</parameter> approaches 0,
|
|
<parameter>nearVal</parameter> must never be set to 0.
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 id="errors"><title>Errors</title>
|
|
<para>
|
|
<constant>GL_INVALID_VALUE</constant> is generated if <parameter>nearVal</parameter> or <parameter>farVal</parameter> is not
|
|
positive, or if <parameter>left</parameter> = <parameter>right</parameter>, or <parameter>bottom</parameter> = <parameter>top</parameter>,
|
|
or <parameter>near</parameter> = <parameter>far</parameter>.
|
|
</para>
|
|
<para>
|
|
<constant>GL_INVALID_OPERATION</constant> is generated if <function>glFrustum</function>
|
|
is executed between the execution of <citerefentry><refentrytitle>glBegin</refentrytitle></citerefentry>
|
|
and the corresponding execution of <citerefentry><refentrytitle>glEnd</refentrytitle></citerefentry>.
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 id="associatedgets"><title>Associated Gets</title>
|
|
<para>
|
|
<citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_MATRIX_MODE</constant>
|
|
</para>
|
|
<para>
|
|
<citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_MODELVIEW_MATRIX</constant>
|
|
</para>
|
|
<para>
|
|
<citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_PROJECTION_MATRIX</constant>
|
|
</para>
|
|
<para>
|
|
<citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_TEXTURE_MATRIX</constant>
|
|
</para>
|
|
<para>
|
|
<citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_COLOR_MATRIX</constant>
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 id="seealso"><title>See Also</title>
|
|
<para>
|
|
<citerefentry><refentrytitle>glOrtho</refentrytitle></citerefentry>,
|
|
<citerefentry><refentrytitle>glMatrixMode</refentrytitle></citerefentry>,
|
|
<citerefentry><refentrytitle>glMultMatrix</refentrytitle></citerefentry>,
|
|
<citerefentry><refentrytitle>glPushMatrix</refentrytitle></citerefentry>,
|
|
<citerefentry><refentrytitle>glViewport</refentrytitle></citerefentry>
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 id="Copyright"><title>Copyright</title>
|
|
<para>
|
|
Copyright <trademark class="copyright"></trademark> 1991-2006
|
|
Silicon Graphics, Inc. This document is licensed under the SGI
|
|
Free Software B License. For details, see
|
|
<ulink url="http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/</ulink>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|