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<H2>C Specification</H2> 13<DL> 14 <DD> 15<PRE><CODE>#include <revolution/gx.h></CODE></PRE> 16 <DD> 17<PRE><CODE>void GXSetViewport( 18f32 xOrig, 19f32 yOrig, 20f32 wd, 21f32 ht, 22f32 nearZ, 23f32 farZ );</CODE></PRE> 24</DL> 25<H2>Arguments</H2> 26<TABLE border="1" cellpadding="3" cellspacing="0.1"> 27 <TBODY> 28 <TR> 29<TD width="120" bgcolor="#ffffe8"><EM><STRONG><CODE>xOrig</CODE></STRONG></EM></TD> 30<TD width="520">Coordinate (in pixels) at the leftmost edge of the screen. <BR>Recommended value range: <CODE>0.0f <= xOrig < 640.0f</CODE></TD> 31 </TR> 32 <TR> 33<TD width="120" bgcolor="#ffffe8"><EM><STRONG><CODE>yOrig</CODE></STRONG></EM></TD> 34<TD width="520">Coordinate (in pixels) at the topmost edge of the screen. <BR>Recommended value range: <CODE>0.0f <= xOrig < 528.0.0f</CODE></TD> 35 </TR> 36 <TR> 37<TD width="120" bgcolor="#ffffe8"><EM><STRONG><CODE>wd</CODE></STRONG></EM></TD> 38<TD width="520">Width of the viewport (in pixels). <BR>Recommended value range: <CODE>0.0f < wd <= (640.0f - xOrig)</CODE></TD> 39 </TR> 40 <TR> 41<TD width="120" bgcolor="#ffffe8"><EM><STRONG><CODE>ht</CODE></STRONG></EM></TD> 42<TD width="520">Height of the viewport (in pixels). <BR>Recommended value range: <CODE>0.0f < ht <= (528.0f - yOrig)</CODE></TD> 43 </TR> 44 <TR> 45<TD width="120" bgcolor="#ffffe8"><EM><STRONG><CODE>nearZ</CODE></STRONG></EM></TD> 46<TD width="520">Floating point value for the near side of the depth scale. <BR>The normalized range is from 0.0f to 1.0f.</TD> 47 </TR> 48 <TR> 49<TD width="120" bgcolor="#ffffe8"><EM><STRONG><CODE>farZ</CODE></STRONG></EM></TD> 50<TD width="520">Floating point value for the far side of the depth scale. <BR>The normalized range is from 0.0f to 1.0f.</TD> 51 </TR> 52 </TBODY> 53</TABLE> 54<H2>Return Values</H2> 55<P>None.</P> 56<H2>Description</H2> 57<P>This function sets the viewport rectangle in screen coordinates. The screen origin (<code>xOrig=0.0f</code>, <code>yOrig=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 viewport depth parameters are normalized coordinates from 0.0f to 1.0f. The GX API will convert the depth range values to proper scale values depending on the type and format of the Z buffer.</P> 58<P>Values for <code>xOrig</code>, <code>yOrig</code>, <code>wd</code> and <code>ht</code> should be within the recommended value ranges. As an example, avoid using negative values for <code>xOrig</code> or <code>yOrig</code>. 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 <a href="../Culling/GXSetScissorBoxOffset.html"><code>GXSetScissorBoxOffset</code></a> instead.</P> 59<P><a href="../Management/GXInit.html"><code>GXInit</code></a> initializes the viewport using the following (<code>rmode</code> is a pointer to the default video mode):</P> 60<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> 61<P>The viewport is typically set using parameters derived from the current render mode, see <a href="../Framebuffer/RenderMode.html"><code>Render Mode</code>s</a>. Refer to the section on <a href="../Framebuffer/RenderMode.html">Render Modes</a>.</P> 62<H2>See Also</H2> 63<P><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></P> 64<H2>Revision History</H2> 65<P>03/01/2006 Initial version.</P> 66</BODY> 67</HTML>