<?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="glOrtho"> 
    <refmeta>
        <refmetainfo>
            <copyright>
                <year>1991-2006</year>
                <holder>Silicon Graphics, Inc.</holder>
            </copyright>
        </refmetainfo>
        <refentrytitle>glOrtho</refentrytitle>
        <manvolnum>3G</manvolnum>
    </refmeta>
    <refnamediv>
        <refname>glOrtho</refname>
        <refpurpose>multiply the current matrix with an orthographic matrix</refpurpose>
    </refnamediv>
    <refsynopsisdiv><title>C Specification</title>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glOrtho</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>
    <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 nearer and farther depth clipping planes.
                    These values are negative if the plane is to be behind the viewer.
                </para>
            </listitem>
        </varlistentry>
        </variablelist>
    </refsect1>
    <refsect1 id="description"><title>Description</title>
        <para>
            <function>glOrtho</function> describes a transformation that produces a parallel 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>
            <informalequation><mml:math>
                <!-- eqn: left (  matrix {    ccol { {2 over {right - eft}} above 0 above 0 above 0 }    ccol { 0 above {2 over {top - bottom}} above 0 above 0 }    ccol { 0 above 0 above {-2 over {farVal - nearVal}}  above 0 }    ccol { {t sub x}  above {t sub y}  above {t sub z}  above 1  } } right ):-->
                <mml:mfenced open="(" close=")">
                    <mml:mtable>
                        <mml:mtr>
                            <mml:mtd>
                                <mml:mfenced open="" close="">
                                    <mml:mfrac>
                                        <mml:mn>2</mml:mn>
                                        <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:mn>0</mml:mn>
                            </mml:mtd>
                            <mml:mtd>
                                <mml:mfenced open="" close="">
                                    <mml:msub><mml:mi mathvariant="italic">t</mml:mi>
                                    <mml:mi mathvariant="italic">x</mml:mi>
                                    </mml:msub>
                                </mml:mfenced>
                            </mml:mtd>
                        </mml:mtr>
                        <mml:mtr>
                            <mml:mtd>
                                <mml:mn>0</mml:mn>
                            </mml:mtd>
                            <mml:mtd>
                                <mml:mfenced open="" close="">
                                    <mml:mfrac>
                                        <mml:mn>2</mml:mn>
                                        <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:mn>0</mml:mn>
                            </mml:mtd>
                            <mml:mtd>
                                <mml:mfenced open="" close="">
                                    <mml:msub><mml:mi mathvariant="italic">t</mml:mi>
                                    <mml:mi mathvariant="italic">y</mml:mi>
                                    </mml:msub>
                                </mml:mfenced>
                            </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:mfenced open="" close="">
                                    <mml:mfrac>
                                        <mml:mn>-2</mml:mn>
                                        <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:mtd>
                            <mml:mtd>
                                <mml:mfenced open="" close="">
                                    <mml:msub><mml:mi mathvariant="italic">t</mml:mi>
                                    <mml:mi mathvariant="italic">z</mml:mi>
                                    </mml:msub>
                                </mml:mfenced>
                            </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>0</mml:mn>
                            </mml:mtd>
                            <mml:mtd>
                                <mml:mn>1</mml:mn>
                            </mml:mtd>
                        </mml:mtr>
                    </mml:mtable>
                </mml:mfenced>
            </mml:math></informalequation>
        </para>
        <para>
            where
            <informalequation><mml:math>
                <!-- eqn: t sub x  =  -{{right  +  left} over {right  -  left}}:-->
                <mml:mrow>
                    <mml:msub><mml:mi mathvariant="italic">t</mml:mi>
                    <mml:mi mathvariant="italic">x</mml:mi>
                    </mml:msub>
                    <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">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:mfenced>
                    </mml:mrow>
                </mml:mrow>
            </mml:math></informalequation>
            <informalequation><mml:math>
                <!-- eqn: t sub y  =  -{{top  +  bottom} over {top  -  bottom}}:-->
                <mml:mrow>
                    <mml:msub><mml:mi mathvariant="italic">t</mml:mi>
                    <mml:mi mathvariant="italic">y</mml:mi>
                    </mml:msub>
                    <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">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:mfenced>
                    </mml:mrow>
                </mml:mrow>
            </mml:math></informalequation>
            <informalequation><mml:math>
                <!-- eqn: t sub z  =  -{{farVal  +  nearVal} over {farVal  -  nearVal}}:-->
                <mml:mrow>
                    <mml:msub><mml:mi mathvariant="italic">t</mml:mi>
                    <mml:mi mathvariant="italic">z</mml:mi>
                    </mml:msub>
                    <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>
            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,
            respectively,
            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> can be either positive or negative.
        </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="errors"><title>Errors</title>
        <para>
            <constant>GL_INVALID_VALUE</constant> is generated 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>glOrtho</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_COLOR_MATRIX</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>
    </refsect1>
    <refsect1 id="seealso"><title>See Also</title>
        <para>
            <citerefentry><refentrytitle>glFrustum</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>
