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 &lt;revolution/gx.h&gt;
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: 0.0f &#x2266; <SPAN class="argument">xOrig</SPAN> &lt; 640.0f.</TD>
32    </TR>
33    <TR>
34<TH>yOrig</TH>
35<TD>Coordinate (in pixels) at the topmost edge of the screen. Recommended value range: 0.0f &#x2266; <SPAN class="argument">yOrig</SPAN> &lt; 528.0f.</TD>
36    </TR>
37    <TR>
38<TH>wd</TH>
39<TD>Width of the viewport (in pixels). <BR>Recommended value range: 0.0f &lt; <SPAN class="argument">wd</SPAN> &#x2266; (640.0f - <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: 0.0f &lt; <SPAN class="argument">ht</SPAN> &#x2266; (528.0f - <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. The normalized range is from 0.0f to 1.0f.</TD>
48    </TR>
49    <TR>
50<TH>farZ</TH>
51<TD>Floating point value for the far side of the depth scale. The normalized range is from 0.0f to 1.0f.</TD>
52    </TR>
53  </TBODY>
54</TABLE>
55
56<H2>Return Values</H2>
57<P>None.</P>
58
59<H2>Description</H2>
60<P>This function sets the viewport rectangle in screen coordinates.&nbsp;The screen origin (<SPAN class="argument">xOrig</SPAN> = 0.0f, <SPAN class="argument">yOrig</SPAN> = 0.0f) 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 the correct scale values depending on 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.&nbsp;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>(&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>
64<P>The viewport is typically set using parameters derived from the current render mode. See <a href="../Framebuffer/RenderMode.html">Render Modes</a>. &nbsp;</P>
65
66<H2>See Also</H2>
67<P class="reference">
68<A href="../Culling/GXSetScissor.html">GXSetScissor</A>,
69<A href="../../mtx/Projection/MTXFrustum.html">MTXFrustum</A>,
70<A href="../Framebuffer/RenderMode.html">Render Modes</A>
71</P>
72
73<H2>Revision History</H2>
74<P>
752006/03/01 Initial version.<br>
76</P>
77
78<hr><p>CONFIDENTIAL</p></body>
79</HTML>