1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<HTML> 3<HEAD> 4<META http-equiv="Content-Type" content="text/html; charset=windows-1252"> 5<META name="GENERATOR" content="Microsoft FrontPage 5.0"> 6<META http-equiv="Content-Style-Type" content="text/css"> 7<LINK rel="stylesheet" type="text/css" href="../../CSS/revolution.css"> 8<TITLE>GXSetViewport</TITLE> 9</HEAD> 10<BODY> 11<H1 align="left">GXSetViewport</H1> 12 13<H2>Syntax</H2> 14<dl><dd><pre class="construction"> 15#include <revolution/gx.h> 16 17void GXSetViewport( 18 f32 xOrig, 19 f32 yOrig, 20 f32 wd, 21 f32 ht, 22 f32 nearZ, 23 f32 farZ ); 24</pre></dd></dl> 25 26<H2>Arguments</H2> 27<TABLE class="arguments" border="1" > 28 <TBODY> 29 <TR> 30<TH>xOrig</TH> 31<TD>Coordinate (in pixels) at the leftmost edge of the screen. Recommended value range: <CODE>0.0f</CODE> ≦ <SPAN class="argument">xOrig</SPAN> < <CODE>640.0f</CODE></TD> 32 </TR> 33 <TR> 34<TH>yOrig</TH> 35<TD>Coordinate (in pixels) at the topmost edge of the screen. Recommended value range: <CODE>0.0f</CODE> ≦ <SPAN class="argument">yOrig</SPAN> < <CODE>528.0f</CODE></TD> 36 </TR> 37 <TR> 38<TH>wd</TH> 39<TD>Width of the viewport (in pixels). <BR>Recommended value range: <CODE>0.0f</CODE> < <SPAN class="argument">wd</SPAN> ≦ (<CODE>640.0f</CODE> - <SPAN class="argument">xOrig</SPAN>).</TD> 40 </TR> 41 <TR> 42<TH>ht</TH> 43<TD>Height of the viewport (in pixels). <BR>Recommended value range: <CODE>0.0f</CODE> < <SPAN class="argument">ht</SPAN> ≦ (<CODE>528.0f</CODE> - <SPAN class="argument">yOrig</SPAN>).</TD> 44 </TR> 45 <TR> 46<TH>nearZ</TH> 47<TD>Floating point value for the near side of the depth scale.</TD> 48 </TR> 49 <TR> 50<TH>farZ</TH> 51<TD>Floating point value for the far side of the depth scale.</TD> 52 </TR> 53 </TBODY> 54</TABLE> 55 56<H2>Return Values</H2> 57<P>None.</P> 58 59<H2>Description</H2> 60<P>Sets the viewport rectangle in screen coordinates. The screen origin (<SPAN class="argument">xOrig</SPAN> = <CODE>0.0f</CODE>, <SPAN class="argument">yOrig</SPAN> = <CODE>0.0f</CODE>) is at the top left corner of the display. Floating point arguments allow the viewport to be adjusted by 1/2 line for interlaced field rendering modes; refer to <a href="GXSetViewportJitter.html"><code>GXSetViewportJitter</code></a>. The GX API converts the viewport depth parameter to depth range values of the proper scale according to the type and format of the Z buffer.</P> 61<P>Values for <SPAN class="argument">xOrig</SPAN>, <SPAN class="argument">yOrig</SPAN>, <SPAN class="argument">wd</SPAN> and <SPAN class="argument">ht</SPAN> should be within the recommended value ranges. As an example, avoid using negative values for <SPAN class="argument">xOrig</SPAN> or <SPAN class="argument">yOrig</SPAN>. Although it may work, it can cause problems where points, lines and extremely large polygons are clipped incorrectly. If you need to shift the viewport up or left, consider using the <A href="../Culling/GXSetScissorBoxOffset.html"><CODE>GXSetScissorBoxOffset</CODE></A> function instead.</P> 62<P>The <A href="../Management/GXInit.html"><CODE>GXInit</CODE></A> function initializes the viewport using the function below (<code>rmode</code> is a pointer to the default video mode).</P> 63<BLOCKQUOTE><CODE><A href="GXSetViewport.html">GXSetViewPort</A>( 0.0f, 0.0f, // xOrig, yOrig<BR> rmode->fbWidth, rmode->xfbHeight, // width, height<BR> 0.0f, 1.0f); // nearZ, farZ</CODE></BLOCKQUOTE> 64<P>The viewport is typically set using parameters derived from the current render mode. See <a href="../Framebuffer/RenderMode.html">Render Modes</a>. </P> 65 66<H2>See Also</H2> 67<P> 68<A href="../Culling/GXSetScissor.html"><CODE>GXSetScissor</CODE></A><BR> <A href="../../mtx/Projection/MTXFrustum.html"><CODE>MTXFrustum</CODE></A><BR> <A href="../Framebuffer/RenderMode.html">Render Modes</A> 69</P> 70 71<H2>Revision History</H2> 72<P> 732008/12/04 Revised the description of depth scale.<br>2006/03/01 Initial version. 74</P> 75 76<hr><p>CONFIDENTIAL</p></body> 77</HTML>