1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html>
3
4<head>
5<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
6<META name="GENERATOR" content="Microsoft FrontPage 5.0">
7<META http-equiv="Content-Style-Type" content="text/css">
8<LINK rel="stylesheet" type="text/css" href="../../CSS/revolution.css">
9<title>GXProject</title>
10</head>
11
12<body>
13
14<h1 align="left">GXProject</h1>
15
16<h2>C Specification</h2>
17
18<dl>
19  <dd><pre><CODE>#include &lt;revolution/gx.h&gt;</CODE></pre>
20  </dd>
21  <dd><pre><CODE>void GXProject(
22    f32          mx,
23    f32          my,
24    f32          mz,
25    const f32    mtx[3][4],
26    const f32*   p,
27    const f32*   vp,
28    f32*         sx,
29    f32*         sy,
30    f32*         sz );</CODE></pre>
31  </dd>
32</dl>
33<h2>Arguments</h2>
34<TABLE border="1" cellpadding="3" cellspacing="0.1">
35  <tr>
36<TD width="120" bgcolor="#ffffe8"><em><strong><CODE>mx, my, mz</CODE></strong></em></TD>
37<TD width="520">Model coordinate to be converted.</TD>
38    </tr>
39  <tr>
40<TD width="120" bgcolor="#ffffe8"><em><strong><CODE>mtx</CODE></strong></em></TD>
41<TD width="520">Model view matrix.</TD>
42    </tr>
43  <tr>
44<TD width="120" bgcolor="#ffffe8"><em><strong><CODE>p</CODE></strong></em></TD>
45<TD width="520">Pointer to projection matrix and its type.</TD>
46    </tr>
47  <tr>
48<TD width="120" bgcolor="#ffffe8"><em><strong><CODE>vp</CODE></strong></em></TD>
49<TD width="520">Pointer to the viewport parameter.</TD>
50    </tr>
51  <tr>
52<TD width="120" bgcolor="#ffffe8"><em><strong><CODE>sx, sy, sz</CODE></strong></em></TD>
53<TD width="520">Screen coordinates calculated by this function.</TD>
54    </tr>
55</TABLE>
56<h2>Return Values</h2>
57
58<p>None.</p>
59<H2>Description</H2>
60<P>This function projects the model coordinate <em><strong><code>(mx, my, mz)</code></strong></em> to screen coordinates <strong><em><code>(sx, sy, sz)</code></em></strong>. The matrix <em><strong><code>mtx</code></strong></em> is the modelview matrix.&nbsp;The array <em><strong><code>p</code></strong></em> is the projection matrix parameters as returned by <a href="GXGetProjectionv.html"><code>GXGetProjectionv</code></a>. &nbsp;The array <em><strong><code>vp</code></strong></em> is the current viewport parameters as returned by <a href="GXGetViewportv.html"><code>GXGetViewportv</code></a>.</P>
61<P>The output coordinates of this function are only valid if the input coordinates are within the proper range.&nbsp;Specifically, <em><strong><code>mz</code></strong></em> must be between the near and far planes as defined by the projection matrix.</P>
62<P>This function simulates the transform pipeline of the Graphics Processor.&nbsp;<BR><BR><B>Note:</B> When computing <strong><em><code>sz</code></em></strong>, this function simulates only the transformation part and not any of the triangle setup or rasterization aspects of the GP.&nbsp;Thus if you were to draw a primitive and read back the Z value for a given screen location (using <code><a href="../Cpu2Efb/GXPeekZ.html">GXPeekZ</a></code>), you cannot expect it to match exactly the <strong><em><code>sz</code></em></strong> value from <a href="GXProject.html"><code>GXProject</code></a> for the same screen location. <BR><BR>The Z values will only be close to matching when <strong><em><code>sx</code></em></strong> and <strong><em><code>sy</code></em></strong> match the exact raster sample location for the pixel.&nbsp;We say &quot;close&quot; since even when <strong><em><code>sx</code></em></strong> and <strong><em><code>sy</code></em></strong> match the raster location exactly, the fixed-point computations used during rasterization may not match the floating point computation used on the CPU.</P>
63<P>In non-antialiased mode, the sample location for the pixel (0, 0) is at (0.5, 0.5).  Refer to <a href="../Framebuffer/GXSetCopyFilter.html"><code>GXSetCopyFilter</code></a> for more details on sample locations.</P>
64
65<h2>See Also</h2>
66
67<p><a href="../../mtx/Projection/MTXFrustum.html"><CODE>MTXFrustum</CODE></a><br> <a href="../../mtx/Projection/MTXPerspective.html"><CODE>MTXPerspective</CODE></a></p>
68<H2>Revision History</H2>
69<P>2006/03/01 Initial version.</P>
70<hr>
71<P>CONFIDENTIAL</p>
72</BODY>
73</HTML>