<?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="glWindowPos"> <refmeta> <refmetainfo> <copyright> <year>1991-2006</year> <holder>Silicon Graphics, Inc.</holder> </copyright> </refmetainfo> <refentrytitle>glWindowPos</refentrytitle> <manvolnum>3G</manvolnum> </refmeta> <refnamediv> <refname>glWindowPos</refname> <refpurpose>specify the raster position in window coordinates for pixel operations</refpurpose> </refnamediv> <refsynopsisdiv><title>C Specification</title> <funcsynopsis> <funcprototype> <funcdef>void <function>glWindowPos2s</function></funcdef> <paramdef>GLshort <parameter>x</parameter></paramdef> <paramdef>GLshort <parameter>y</parameter></paramdef> </funcprototype> </funcsynopsis> <funcsynopsis> <funcprototype> <funcdef>void <function>glWindowPos2i</function></funcdef> <paramdef>GLint <parameter>x</parameter></paramdef> <paramdef>GLint <parameter>y</parameter></paramdef> </funcprototype> </funcsynopsis> <funcsynopsis> <funcprototype> <funcdef>void <function>glWindowPos2f</function></funcdef> <paramdef>GLfloat <parameter>x</parameter></paramdef> <paramdef>GLfloat <parameter>y</parameter></paramdef> </funcprototype> </funcsynopsis> <funcsynopsis> <funcprototype> <funcdef>void <function>glWindowPos2d</function></funcdef> <paramdef>GLdouble <parameter>x</parameter></paramdef> <paramdef>GLdouble <parameter>y</parameter></paramdef> </funcprototype> </funcsynopsis> <funcsynopsis> <funcprototype> <funcdef>void <function>glWindowPos3s</function></funcdef> <paramdef>GLshort <parameter>x</parameter></paramdef> <paramdef>GLshort <parameter>y</parameter></paramdef> <paramdef>GLshort <parameter>z</parameter></paramdef> </funcprototype> </funcsynopsis> <funcsynopsis> <funcprototype> <funcdef>void <function>glWindowPos3i</function></funcdef> <paramdef>GLint <parameter>x</parameter></paramdef> <paramdef>GLint <parameter>y</parameter></paramdef> <paramdef>GLint <parameter>z</parameter></paramdef> </funcprototype> </funcsynopsis> <funcsynopsis> <funcprototype> <funcdef>void <function>glWindowPos3f</function></funcdef> <paramdef>GLfloat <parameter>x</parameter></paramdef> <paramdef>GLfloat <parameter>y</parameter></paramdef> <paramdef>GLfloat <parameter>z</parameter></paramdef> </funcprototype> </funcsynopsis> <funcsynopsis> <funcprototype> <funcdef>void <function>glWindowPos3d</function></funcdef> <paramdef>GLdouble <parameter>x</parameter></paramdef> <paramdef>GLdouble <parameter>y</parameter></paramdef> <paramdef>GLdouble <parameter>z</parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <!-- eqn: ignoring delim $$ --> <refsect1 id="parameters"><title>Parameters</title> <variablelist> <varlistentry> <term><parameter>x</parameter></term> <term><parameter>y</parameter></term> <term><parameter>z</parameter></term> <listitem> <para> Specify the <inlineequation><mml:math><mml:mi mathvariant="italic">x</mml:mi></mml:math></inlineequation>, <inlineequation><mml:math><mml:mi mathvariant="italic">y</mml:mi></mml:math></inlineequation>, <inlineequation><mml:math><mml:mi mathvariant="italic">z</mml:mi></mml:math></inlineequation> coordinates for the raster position. </para> </listitem> </varlistentry> </variablelist> </refsect1> <refsynopsisdiv><title>C Specification</title> <funcsynopsis> <funcprototype> <funcdef>void <function>glWindowPos2sv</function></funcdef> <paramdef>const GLshort * <parameter>v</parameter></paramdef> </funcprototype> </funcsynopsis> <funcsynopsis> <funcprototype> <funcdef>void <function>glWindowPos2iv</function></funcdef> <paramdef>const GLint * <parameter>v</parameter></paramdef> </funcprototype> </funcsynopsis> <funcsynopsis> <funcprototype> <funcdef>void <function>glWindowPos2fv</function></funcdef> <paramdef>const GLfloat * <parameter>v</parameter></paramdef> </funcprototype> </funcsynopsis> <funcsynopsis> <funcprototype> <funcdef>void <function>glWindowPos2dv</function></funcdef> <paramdef>const GLdouble * <parameter>v</parameter></paramdef> </funcprototype> </funcsynopsis> <funcsynopsis> <funcprototype> <funcdef>void <function>glWindowPos3sv</function></funcdef> <paramdef>const GLshort * <parameter>v</parameter></paramdef> </funcprototype> </funcsynopsis> <funcsynopsis> <funcprototype> <funcdef>void <function>glWindowPos3iv</function></funcdef> <paramdef>const GLint * <parameter>v</parameter></paramdef> </funcprototype> </funcsynopsis> <funcsynopsis> <funcprototype> <funcdef>void <function>glWindowPos3fv</function></funcdef> <paramdef>const GLfloat * <parameter>v</parameter></paramdef> </funcprototype> </funcsynopsis> <funcsynopsis> <funcprototype> <funcdef>void <function>glWindowPos3dv</function></funcdef> <paramdef>const GLdouble * <parameter>v</parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="parameters2"><title>Parameters</title> <variablelist> <varlistentry> <term><parameter>v</parameter></term> <listitem> <para> Specifies a pointer to an array of two or three elements, specifying <inlineequation><mml:math><mml:mi mathvariant="italic">x</mml:mi></mml:math></inlineequation>, <inlineequation><mml:math><mml:mi mathvariant="italic">y</mml:mi></mml:math></inlineequation>, <inlineequation><mml:math><mml:mi mathvariant="italic">z</mml:mi></mml:math></inlineequation> coordinates, respectively. </para> </listitem> </varlistentry> </variablelist> </refsect1> <refsect1 id="description"><title>Description</title> <para> The GL maintains a 3D position in window coordinates. This position, called the raster position, is used to position pixel and bitmap write operations. It is maintained with subpixel accuracy. See <citerefentry><refentrytitle>glBitmap</refentrytitle></citerefentry>, <citerefentry><refentrytitle>glDrawPixels</refentrytitle></citerefentry>, and <citerefentry><refentrytitle>glCopyPixels</refentrytitle></citerefentry>. </para> <para> <function>glWindowPos2</function> specifies the <inlineequation><mml:math><mml:mi mathvariant="italic">x</mml:mi></mml:math></inlineequation> and <inlineequation><mml:math><mml:mi mathvariant="italic">y</mml:mi></mml:math></inlineequation> coordinates, while <inlineequation><mml:math><mml:mi mathvariant="italic">z</mml:mi></mml:math></inlineequation> is implicitly set to 0. <function>glWindowPos3</function> specifies all three coordinates. The <inlineequation><mml:math><mml:mi mathvariant="italic">w</mml:mi></mml:math></inlineequation> coordinate of the current raster position is always set to 1.0. </para> <para> <function>glWindowPos</function> directly updates the <inlineequation><mml:math><mml:mi mathvariant="italic">x</mml:mi></mml:math></inlineequation> and <inlineequation><mml:math><mml:mi mathvariant="italic">y</mml:mi></mml:math></inlineequation> coordinates of the current raster position with the values specified. That is, the values are neither transformed by the current modelview and projection matrices, nor by the viewport-to-window transform. The <inlineequation><mml:math><mml:mi mathvariant="italic">z</mml:mi></mml:math></inlineequation> coordinate of the current raster position is updated in the following manner: </para> <para> <informalequation><mml:math> <!-- eqn: z = left{ lpile { n above f above {n + z * (f - n)} } lpile { if z <= 0 above if z >= 1 above {roman otherwise} }:--> <mml:mrow> <mml:mi mathvariant="italic">z</mml:mi> <mml:mo>=</mml:mo> <mml:mfenced open="{" close=""> <mml:mrow> <mml:mtable> <mml:mtr><mml:mtd> <mml:mi mathvariant="italic">n</mml:mi> </mml:mtd></mml:mtr> <mml:mtr><mml:mtd> <mml:mi mathvariant="italic">f</mml:mi> </mml:mtd></mml:mtr> <mml:mtr><mml:mtd> <mml:mfenced open="" close=""> <mml:mrow> <mml:mi mathvariant="italic">n</mml:mi> <mml:mo>+</mml:mo> <mml:mrow> <mml:mi mathvariant="italic">z</mml:mi> <mml:mo>×</mml:mo> <mml:mfenced open="(" close=")"> <mml:mrow> <mml:mi mathvariant="italic">f</mml:mi> <mml:mo>-</mml:mo> <mml:mi mathvariant="italic">n</mml:mi> </mml:mrow> </mml:mfenced> </mml:mrow> </mml:mrow> </mml:mfenced> </mml:mtd></mml:mtr> </mml:mtable> <mml:mo>⁢</mml:mo> <mml:mtable> <mml:mtr><mml:mtd> <mml:mrow> <mml:mrow> <mml:mi mathvariant="italic">if</mml:mi> <mml:mo>⁢</mml:mo> <mml:mi mathvariant="italic">z</mml:mi> </mml:mrow> <mml:mo><=</mml:mo> <mml:mn>0</mml:mn> </mml:mrow> </mml:mtd></mml:mtr> <mml:mtr><mml:mtd> <mml:mrow> <mml:mrow> <mml:mi mathvariant="italic">if</mml:mi> <mml:mo>⁢</mml:mo> <mml:mi mathvariant="italic">z</mml:mi> </mml:mrow> <mml:mo>>=</mml:mo> <mml:mn>1</mml:mn> </mml:mrow> </mml:mtd></mml:mtr> <mml:mtr><mml:mtd> <mml:mfenced open="" close=""> <mml:mi mathvariant="normal">otherwise</mml:mi> </mml:mfenced> </mml:mtd></mml:mtr> </mml:mtable> </mml:mrow> </mml:mfenced> </mml:mrow> </mml:math></informalequation> </para> <para> </para> <para> where <inlineequation><mml:math><mml:mi mathvariant="italic">n</mml:mi></mml:math></inlineequation> is <constant>GL_DEPTH_RANGE</constant>'s near value, and <inlineequation><mml:math><mml:mi mathvariant="italic">f</mml:mi></mml:math></inlineequation> is <constant>GL_DEPTH_RANGE</constant>'s far value. See <citerefentry><refentrytitle>glDepthRange</refentrytitle></citerefentry>. </para> <para> The specified coordinates are not clip-tested, causing the raster position to always be valid. </para> <para> The current raster position also includes some associated color data and texture coordinates. If lighting is enabled, then <constant>GL_CURRENT_RASTER_COLOR</constant> (in RGBA mode) or <constant>GL_CURRENT_RASTER_INDEX</constant> (in color index mode) is set to the color produced by the lighting calculation (see <citerefentry><refentrytitle>glLight</refentrytitle></citerefentry>, <citerefentry><refentrytitle>glLightModel</refentrytitle></citerefentry>, and <citerefentry><refentrytitle>glShadeModel</refentrytitle></citerefentry>). If lighting is disabled, current color (in RGBA mode, state variable <constant>GL_CURRENT_COLOR</constant>) or color index (in color index mode, state variable <constant>GL_CURRENT_INDEX</constant>) is used to update the current raster color. <constant>GL_CURRENT_RASTER_SECONDARY_COLOR</constant> (in RGBA mode) is likewise updated. </para> <para> Likewise, <constant>GL_CURRENT_RASTER_TEXTURE_COORDS</constant> is updated as a function of <constant>GL_CURRENT_TEXTURE_COORDS</constant>, based on the texture matrix and the texture generation functions (see <citerefentry><refentrytitle>glTexGen</refentrytitle></citerefentry>). The <constant>GL_CURRENT_RASTER_DISTANCE</constant> is set to the <constant>GL_CURRENT_FOG_COORD</constant>. </para> <para> </para> </refsect1> <refsect1 id="notes"><title>Notes</title> <para> <function>glWindowPos</function> is available only if the GL version is 1.4 or greater. </para> <para> The raster position is modified by <citerefentry><refentrytitle>glRasterPos</refentrytitle></citerefentry>, <citerefentry><refentrytitle>glBitmap</refentrytitle></citerefentry>, and <function>glWindowPos</function>. </para> <para> Calling <citerefentry><refentrytitle>glDrawElements</refentrytitle></citerefentry>, or <citerefentry><refentrytitle>glDrawRangeElements</refentrytitle></citerefentry> may leave the current color or index indeterminate. If <function>glWindowPos</function> is executed while the current color or index is indeterminate, the current raster color or current raster index remains indeterminate. </para> <para> There are distinct raster texture coordinates for each texture unit. Each texture unit's current raster texture coordinates are updated by <function>glWindowPos</function>. </para> </refsect1> <refsect1 id="errors"><title>Errors</title> <para> <constant>GL_INVALID_OPERATION</constant> is generated if <function>glWindowPos</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_CURRENT_RASTER_POSITION</constant> </para> <para> <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_CURRENT_RASTER_POSITION_VALID</constant> </para> <para> <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_CURRENT_RASTER_DISTANCE</constant> </para> <para> <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_CURRENT_RASTER_COLOR</constant> </para> <para> <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_CURRENT_RASTER_SECONDARY_COLOR</constant> </para> <para> <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_CURRENT_RASTER_INDEX</constant> </para> <para> <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_CURRENT_RASTER_TEXTURE_COORDS</constant> </para> </refsect1> <refsect1 id="seealso"><title>See Also</title> <para> <citerefentry><refentrytitle>glBitmap</refentrytitle></citerefentry>, <citerefentry><refentrytitle>glCopyPixels</refentrytitle></citerefentry>, <citerefentry><refentrytitle>glDrawArrays</refentrytitle></citerefentry>, <citerefentry><refentrytitle>glDrawElements</refentrytitle></citerefentry>, <citerefentry><refentrytitle>glDrawRangeElements</refentrytitle></citerefentry>, <citerefentry><refentrytitle>glDrawPixels</refentrytitle></citerefentry>, <citerefentry><refentrytitle>glMultiTexCoord</refentrytitle></citerefentry>, <citerefentry><refentrytitle>glRasterPos</refentrytitle></citerefentry>, <citerefentry><refentrytitle>glTexCoord</refentrytitle></citerefentry>, <citerefentry><refentrytitle>glTexGen</refentrytitle></citerefentry>, <citerefentry><refentrytitle>glVertex</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>