Subversion Repositories AndroidProjects

Rev

Blame | Last modification | View Log | RSS feed

<?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="gluUnProject">
    <refmeta>
        <refmetainfo>
            <copyright>
                <year>1991-2006</year>
                <holder>Silicon Graphics, Inc.</holder>
            </copyright>
        </refmetainfo>
        <refentrytitle>gluUnProject</refentrytitle>
        <manvolnum>3G</manvolnum>
    </refmeta>
    <refnamediv>
        <refname>gluUnProject</refname>
        <refpurpose>map window coordinates to object coordinates</refpurpose>
    </refnamediv>
    <refsynopsisdiv><title>C Specification</title>
        <funcsynopsis>
            <funcprototype>
                <funcdef>GLint <function>gluUnProject</function></funcdef>
                <paramdef>GLdouble <parameter>winX</parameter></paramdef>
                <paramdef>GLdouble <parameter>winY</parameter></paramdef>
                <paramdef>GLdouble <parameter>winZ</parameter></paramdef>
                <paramdef>const GLdouble * <parameter>model</parameter></paramdef>
                <paramdef>const GLdouble * <parameter>proj</parameter></paramdef>
                <paramdef>const GLint * <parameter>view</parameter></paramdef>
                <paramdef>GLdouble* <parameter>objX</parameter></paramdef>
                <paramdef>GLdouble* <parameter>objY</parameter></paramdef>
                <paramdef>GLdouble* <parameter>objZ</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
    </refsynopsisdiv>
    <!-- eqn: ignoring delim $$ -->
    <refsect1 id="parameters"><title>Parameters</title>
        <variablelist>
        <varlistentry>
            <term><parameter>winX</parameter></term>
            <term><parameter>winY</parameter></term>
            <term><parameter>winZ</parameter></term>
            <listitem>
                <para>
                    Specify the window coordinates to be mapped.
                </para>
            </listitem>
        </varlistentry>
        <varlistentry>
            <term><parameter>model</parameter></term>
            <listitem>
                <para>
                    Specifies the modelview matrix (as from a <citerefentry><refentrytitle>glGetDoublev</refentrytitle></citerefentry> call).
                </para>
            </listitem>
        </varlistentry>
        <varlistentry>
            <term><parameter>proj</parameter></term>
            <listitem>
                <para>
                    Specifies the projection matrix (as from a <citerefentry><refentrytitle>glGetDoublev</refentrytitle></citerefentry> call).
                </para>
            </listitem>
        </varlistentry>
        <varlistentry>
            <term><parameter>view</parameter></term>
            <listitem>
                <para>
                    Specifies the viewport (as from a <citerefentry><refentrytitle>glGetIntegerv</refentrytitle></citerefentry> call).
                </para>
            </listitem>
        </varlistentry>
        <varlistentry>
            <term><parameter>objX</parameter></term>
            <term><parameter>objY</parameter></term>
            <term><parameter>objZ</parameter></term>
            <listitem>
                <para>
                    Returns the computed object coordinates.
                </para>
            </listitem>
        </varlistentry>
        </variablelist>
    </refsect1>
    <refsect1 id="description"><title>Description</title>
        <para>
            <function>gluUnProject</function> maps the specified window coordinates into object
            coordinates using <parameter>model</parameter>, <parameter>proj</parameter>, and <parameter>view</parameter>.
            The result is stored in <parameter>objX</parameter>, <parameter>objY</parameter>, and <parameter>objZ</parameter>. A return value of
            <constant>GLU_TRUE</constant> indicates success; a return value of <constant>GLU_FALSE</constant>
            indicates failure.
        </para>
        <para>
            To compute the coordinates
            <inlineequation><mml:math>
                <!-- eqn: (objX, objY, objZ):-->
                <mml:mfenced open="(" close=")">
                    <mml:mi mathvariant="italic">objX</mml:mi>
                    <mml:mi mathvariant="italic">objY</mml:mi>
                    <mml:mi mathvariant="italic">objZ</mml:mi>
                </mml:mfenced>
            </mml:math></inlineequation>,
            <function>gluUnProject</function> multiplies the normalized device coordinates by the inverse of
            <parameter>model</parameter> * <parameter>proj</parameter> as follows:
        </para>
        <para>
            <informalequation><mml:math>
                <!-- eqn: left ( cpile {       objX above  objY above  objZ above  W}     right )  =  INV(P M)  left ( cpile {      {2(winX  -  view[0])} over {view [2]}  -  1 above      {2(winY  -  view[1])} over {view[3]}  -  1 above      2(winZ)  -  1 above      1 }    right ):-->
                <mml:mrow>
                    <mml:mfenced open="(" close=")">
                        <mml:mtable>
                            <mml:mtr><mml:mtd>
                                <mml:mi mathvariant="italic">objX</mml:mi>
                            </mml:mtd></mml:mtr>
                            <mml:mtr><mml:mtd>
                                <mml:mi mathvariant="italic">objY</mml:mi>
                            </mml:mtd></mml:mtr>
                            <mml:mtr><mml:mtd>
                                <mml:mi mathvariant="italic">objZ</mml:mi>
                            </mml:mtd></mml:mtr>
                            <mml:mtr><mml:mtd>
                                <mml:mi mathvariant="italic">W</mml:mi>
                            </mml:mtd></mml:mtr>
                        </mml:mtable>
                    </mml:mfenced>
                    <mml:mo>=</mml:mo>
                    <mml:mrow>
                        <mml:mrow>
                            <mml:mi mathvariant="italic">INV</mml:mi>
                            <mml:mo>&af;</mml:mo>
                            <mml:mfenced open="(" close=")">
                                <mml:mrow>
                                    <mml:mi mathvariant="italic">P</mml:mi>
                                    <mml:mo>&it;</mml:mo>
                                    <mml:mi mathvariant="italic">M</mml:mi>
                                </mml:mrow>
                            </mml:mfenced>
                        </mml:mrow>
                        <mml:mo>&it;</mml:mo>
                        <mml:mfenced open="(" close=")">
                            <mml:mtable>
                                <mml:mtr><mml:mtd>
                                    <mml:mrow>
                                        <mml:mfrac>
                                            <mml:mfenced open="" close="">
                                                <mml:mrow>
                                                    <mml:mn>2</mml:mn>
                                                    <mml:mo>&af;</mml:mo>
                                                    <mml:mfenced open="(" close=")">
                                                        <mml:mrow>
                                                            <mml:mi mathvariant="italic">winX</mml:mi>
                                                            <mml:mo>-</mml:mo>
                                                            <mml:mrow>
                                                                <mml:mi mathvariant="italic">view</mml:mi>
                                                                <mml:mo>&af;</mml:mo>
                                                                <mml:mfenced open="[" close="]">
                                                                    <mml:mn>0</mml:mn>
                                                                </mml:mfenced>
                                                            </mml:mrow>
                                                        </mml:mrow>
                                                    </mml:mfenced>
                                                </mml:mrow>
                                            </mml:mfenced>
                                            <mml:mfenced open="" close="">
                                                <mml:mrow>
                                                    <mml:mi mathvariant="italic">view</mml:mi>
                                                    <mml:mo>&af;</mml:mo>
                                                    <mml:mfenced open="[" close="]">
                                                        <mml:mn>2</mml:mn>
                                                    </mml:mfenced>
                                                </mml:mrow>
                                            </mml:mfenced>
                                        </mml:mfrac>
                                        <mml:mo>-</mml:mo>
                                        <mml:mn>1</mml:mn>
                                    </mml:mrow>
                                </mml:mtd></mml:mtr>
                                <mml:mtr><mml:mtd>
                                    <mml:mrow>
                                        <mml:mfrac>
                                            <mml:mfenced open="" close="">
                                                <mml:mrow>
                                                    <mml:mn>2</mml:mn>
                                                    <mml:mo>&af;</mml:mo>
                                                    <mml:mfenced open="(" close=")">
                                                        <mml:mrow>
                                                            <mml:mi mathvariant="italic">winY</mml:mi>
                                                            <mml:mo>-</mml:mo>
                                                            <mml:mrow>
                                                                <mml:mi mathvariant="italic">view</mml:mi>
                                                                <mml:mo>&af;</mml:mo>
                                                                <mml:mfenced open="[" close="]">
                                                                    <mml:mn>1</mml:mn>
                                                                </mml:mfenced>
                                                            </mml:mrow>
                                                        </mml:mrow>
                                                    </mml:mfenced>
                                                </mml:mrow>
                                            </mml:mfenced>
                                            <mml:mfenced open="" close="">
                                                <mml:mrow>
                                                    <mml:mi mathvariant="italic">view</mml:mi>
                                                    <mml:mo>&af;</mml:mo>
                                                    <mml:mfenced open="[" close="]">
                                                        <mml:mn>3</mml:mn>
                                                    </mml:mfenced>
                                                </mml:mrow>
                                            </mml:mfenced>
                                        </mml:mfrac>
                                        <mml:mo>-</mml:mo>
                                        <mml:mn>1</mml:mn>
                                    </mml:mrow>
                                </mml:mtd></mml:mtr>
                                <mml:mtr><mml:mtd>
                                    <mml:mrow>
                                        <mml:mrow>
                                            <mml:mn>2</mml:mn>
                                            <mml:mo>&af;</mml:mo>
                                            <mml:mfenced open="(" close=")">
                                                <mml:mi mathvariant="italic">winZ</mml:mi>
                                            </mml:mfenced>
                                        </mml:mrow>
                                        <mml:mo>-</mml:mo>
                                        <mml:mn>1</mml:mn>
                                    </mml:mrow>
                                </mml:mtd></mml:mtr>
                                <mml:mtr><mml:mtd>
                                    <mml:mn>1</mml:mn>
                                </mml:mtd></mml:mtr>
                            </mml:mtable>
                        </mml:mfenced>
                    </mml:mrow>
                </mml:mrow>
            </mml:math></informalequation>
            <inlineequation><mml:math><mml:mi mathvariant="italic">INV</mml:mi></mml:math></inlineequation>
            denotes matrix inversion.
            W is an unused variable, included for consistent matrix notation.
        </para>
    </refsect1>
    <refsect1 id="seealso"><title>See Also</title>
        <para>
            <citerefentry><refentrytitle>gluProject</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glGet</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>