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>Syntax</h2> 17<dl><dd><pre class="construction"> 18#include <revolution/gx.h> 19 20void GXProject( 21 f32 mx, 22 f32 my, 23 f32 mz, 24 const f32 mtx[3][4], 25 const f32* p, 26 const f32* vp, 27 f32* sx, 28 f32* sy, 29 f32* sz ); 30</pre></dd></dl> 31 32<h2>Arguments</h2> 33<TABLE class="arguments" border="1" > 34 <tr> 35<TH>mx, my, mz</TH> 36<TD>Model coordinate to be converted.</TD> 37 </tr> 38 <tr> 39<TH><STRONG><EM><CODE>mtx</CODE></EM></STRONG></TH> 40<TD>Model view matrix.</TD> 41 </tr> 42 <tr> 43<TH>p</TH> 44<TD>Pointer to projection matrix and its type.</TD> 45 </tr> 46 <tr> 47<TH>vp</TH> 48<TD>Pointer to the viewport parameter.</TD> 49 </tr> 50 <tr> 51<TH>sx, sy, sz</TH> 52<TD>Screen coordinates calculated by this function.</TD> 53 </tr> 54</TABLE> 55 56<h2>Return Values</h2> 57<p>None.</p> 58 59<H2>Description</H2> 60<P>This function projects the model coordinates <SPAN class="argument">( mx, my, mz )</SPAN> to screen coordinates <SPAN class="argument">( sx, sy, sz )</SPAN>. The matrix <SPAN class="argument">mtx</SPAN> is the modelview matrix. The array <SPAN class="argument">p</SPAN> is the projection matrix parameters as returned by the <A href="GXGetProjectionv.html"><CODE>GXGetProjectionv</CODE></A> function. The array <SPAN class="argument">vp</SPAN> is the current viewport parameters as returned by the <A href="GXGetViewportv.html"><CODE>GXGetViewportv</CODE></A> function.</P> 61<P>The output coordinates of this function are only valid if the input coordinates are within the proper range. Specifically, <SPAN class="argument">mz</SPAN> 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. <BR><BR><B>Note:</B> When computing <SPAN class="argument">sz</SPAN>, this function simulates only the transformation part and not any of the triangle setup or rasterization aspects of the GP. Thus if you were to render a primitive and read back the Z value for a given screen location (using the <A href="../Cpu2Efb/GXPeekZ.html"><CODE>GXPeekZ</CODE></A> function), you could not expect it to match exactly the <SPAN class="argument">sz</SPAN> value from the <CODE>GXProject</CODE> function for the same screen location. The Z values will only be close to matching when <SPAN class="argument">sx</SPAN> and <SPAN class="argument">sy</SPAN> match the exact raster sampling location for the pixels. We say "close" since even when <SPAN class="argument">sx</SPAN> and <SPAN class="argument">sy</SPAN> 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 the <A href="../Framebuffer/GXSetCopyFilter.html"><CODE>GXSetCopyFilter</CODE></A> function for more details on sample locations.</P> 64 65<h2>See Also</h2> 66<p class="reference"> 67<a href="../../mtx/Projection/MTXFrustum.html">MTXFrustum</a>, 68<a href="../../mtx/Projection/MTXPerspective.html">MTXPerspective</a> 69</p> 70 71<H2>Revision History</H2> 72<P> 732006/03/01 Initial version.<br> 74</P> 75 76<hr><p>CONFIDENTIAL</p></body> 77</HTML>