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 &lt;revolution/gx.h&gt;</CODE></PRE>
16  <DD>
17  <PRE><CODE>void GXSetViewport(
18    f32 xOrig,
19    f32 yOrig,
20    f32 wd,
21    f32 ht,
22    f32 nearZ,
23    f32 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 &lt;= xOrig &lt; 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 &lt;= xOrig &lt; 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 &lt; wd &lt;= (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 &lt; ht &lt;= (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.&nbsp;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.&nbsp;The GX API will convert the depth range values to&nbsp; 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.&nbsp;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>(&nbsp; 0.0f,&nbsp;&nbsp; 0.0f, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // xOrig, yOrig<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; rmode-&gt;fbWidth, rmode-&gt;xfbHeight, // width, height<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;0.0f,&nbsp;&nbsp; 1.0f); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 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>2006/03/01 Initial version.</P>
66<hr>
67<P>CONFIDENTIAL</p>
68</BODY>
69</HTML>