Opentk/Source/Bind/Specifications/Docs/gluProject.xml
2009-03-08 00:46:58 +00:00

294 lines
14 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="gluProject">
<refmeta>
<refmetainfo>
<copyright>
<year>1991-2006</year>
<holder>Silicon Graphics, Inc.</holder>
</copyright>
</refmetainfo>
<refentrytitle>gluProject</refentrytitle>
<manvolnum>3G</manvolnum>
</refmeta>
<refnamediv>
<refname>gluProject</refname>
<refpurpose>map object coordinates to window coordinates</refpurpose>
</refnamediv>
<refsynopsisdiv><title>C Specification</title>
<funcsynopsis>
<funcprototype>
<funcdef>GLint <function>gluProject</function></funcdef>
<paramdef>GLdouble <parameter>objX</parameter></paramdef>
<paramdef>GLdouble <parameter>objY</parameter></paramdef>
<paramdef>GLdouble <parameter>objZ</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>winX</parameter></paramdef>
<paramdef>GLdouble* <parameter>winY</parameter></paramdef>
<paramdef>GLdouble* <parameter>winZ</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<!-- eqn: ignoring delim $$ -->
<refsect1 id="parameters"><title>Parameters</title>
<variablelist>
<varlistentry>
<term><parameter>objX</parameter></term>
<term><parameter>objY</parameter></term>
<term><parameter>objZ</parameter></term>
<listitem>
<para>
Specify the object coordinates.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>model</parameter></term>
<listitem>
<para>
Specifies the current modelview matrix (as from a <citerefentry><refentrytitle>glGetDoublev</refentrytitle></citerefentry> call).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>proj</parameter></term>
<listitem>
<para>
Specifies the current projection matrix (as from a <citerefentry><refentrytitle>glGetDoublev</refentrytitle></citerefentry> call).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>view</parameter></term>
<listitem>
<para>
Specifies the current viewport (as from a <citerefentry><refentrytitle>glGetIntegerv</refentrytitle></citerefentry> call).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>winX</parameter></term>
<term><parameter>winY</parameter></term>
<term><parameter>winZ</parameter></term>
<listitem>
<para>
Return the computed window coordinates.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 id="description"><title>Description</title>
<para>
<function>gluProject</function> transforms the specified object coordinates into window coordinates
using <parameter>model</parameter>, <parameter>proj</parameter>, and <parameter>view</parameter>. The result is stored
in <parameter>winX</parameter>, <parameter>winY</parameter>, and <parameter>winZ</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,
let
<inlineequation><mml:math>
<!-- eqn: v = (objX, objY, objZ, 1.0):-->
<mml:mrow>
<mml:mi mathvariant="italic">v</mml:mi>
<mml:mo>=</mml:mo>
<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:mn>1.0</mml:mn>
</mml:mfenced>
</mml:mrow>
</mml:math></inlineequation>
represented as a matrix with 4 rows and 1 column.
Then <function>gluProject</function> computes
<inlineequation><mml:math>
<!-- eqn: v sup prime:-->
<mml:msup><mml:mi mathvariant="italic">v</mml:mi>
<mml:mo>&Prime;</mml:mo>
</mml:msup>
</mml:math></inlineequation>
as follows:
</para>
<para>
<informalequation><mml:math>
<!-- eqn: v sup prime = P times M times v:-->
<mml:mrow>
<mml:msup><mml:mi mathvariant="italic">v</mml:mi>
<mml:mo>&Prime;</mml:mo>
</mml:msup>
<mml:mo>=</mml:mo>
<mml:mrow>
<mml:mi mathvariant="italic">P</mml:mi>
<mml:mo>&times;</mml:mo>
<mml:mi mathvariant="italic">M</mml:mi>
<mml:mo>&times;</mml:mo>
<mml:mi mathvariant="italic">v</mml:mi>
</mml:mrow>
</mml:mrow>
</mml:math></informalequation>
</para>
<para>
where
<inlineequation><mml:math><mml:mi mathvariant="italic">P</mml:mi></mml:math></inlineequation>
is the current projection matrix <parameter>proj</parameter> and
<inlineequation><mml:math><mml:mi mathvariant="italic">M</mml:mi></mml:math></inlineequation>
is the current
modelview matrix <parameter>model</parameter> (both represented as
<inlineequation><mml:math>
<!-- eqn: 4 times 4:-->
<mml:mrow>
<mml:mn>4</mml:mn>
<mml:mo>&times;</mml:mo>
<mml:mn>4</mml:mn>
</mml:mrow>
</mml:math></inlineequation>
matrices in column-major order).
</para>
<para>
The window coordinates are then computed as follows:
</para>
<para>
<informalequation><mml:math>
<!-- eqn: winX = view (0) + view (2) * (v sup prime (0) + 1) / 2:-->
<mml:mrow>
<mml:mi mathvariant="italic">winX</mml:mi>
<mml:mo>=</mml:mo>
<mml:mrow>
<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:mo>+</mml:mo>
<mml:mfrac>
<mml:mrow>
<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:mo>&times;</mml:mo>
<mml:mfenced open="(" close=")">
<mml:mrow>
<mml:mrow>
<mml:msup><mml:mi mathvariant="italic">v</mml:mi>
<mml:mo>&Prime;</mml:mo>
</mml:msup>
<mml:mo>&af;</mml:mo>
<mml:mfenced open="(" close=")">
<mml:mn>0</mml:mn>
</mml:mfenced>
</mml:mrow>
<mml:mo>+</mml:mo>
<mml:mn>1</mml:mn>
</mml:mrow>
</mml:mfenced>
</mml:mrow>
<mml:mn>2</mml:mn>
</mml:mfrac>
</mml:mrow>
</mml:mrow>
</mml:math></informalequation>
<para>
<informalequation><mml:math>
<!-- eqn: winY = view (1) + view (3) * (v sup prime (1) + 1) / 2:-->
<mml:mrow>
<mml:mi mathvariant="italic">winY</mml:mi>
<mml:mo>=</mml:mo>
<mml:mrow>
<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:mo>+</mml:mo>
<mml:mfrac>
<mml:mrow>
<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:mo>&times;</mml:mo>
<mml:mfenced open="(" close=")">
<mml:mrow>
<mml:mrow>
<mml:msup><mml:mi mathvariant="italic">v</mml:mi>
<mml:mo>&Prime;</mml:mo>
</mml:msup>
<mml:mo>&af;</mml:mo>
<mml:mfenced open="(" close=")">
<mml:mn>1</mml:mn>
</mml:mfenced>
</mml:mrow>
<mml:mo>+</mml:mo>
<mml:mn>1</mml:mn>
</mml:mrow>
</mml:mfenced>
</mml:mrow>
<mml:mn>2</mml:mn>
</mml:mfrac>
</mml:mrow>
</mml:mrow>
</mml:math></informalequation>
</para>
<para>
<informalequation><mml:math>
<!-- eqn: winZ = (v sup prime (2) + 1) / 2:-->
<mml:mrow>
<mml:mi mathvariant="italic">winZ</mml:mi>
<mml:mo>=</mml:mo>
<mml:mfrac>
<mml:mfenced open="(" close=")">
<mml:mrow>
<mml:mrow>
<mml:msup><mml:mi mathvariant="italic">v</mml:mi>
<mml:mo>&Prime;</mml:mo>
</mml:msup>
<mml:mo>&af;</mml:mo>
<mml:mfenced open="(" close=")">
<mml:mn>2</mml:mn>
</mml:mfenced>
</mml:mrow>
<mml:mo>+</mml:mo>
<mml:mn>1</mml:mn>
</mml:mrow>
</mml:mfenced>
<mml:mn>2</mml:mn>
</mml:mfrac>
</mml:mrow>
</mml:math></informalequation>
</para>
</para>
<para>
</para>
</refsect1>
<refsect1 id="seealso"><title>See Also</title>
<para>
<citerefentry><refentrytitle>gluUnProject</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>