#include <revolution/gx.h>
void GXSetViewport(
f32 xOrig,
f32 yOrig,
f32 wd,
f32 ht,
f32 nearZ,
f32 farZ );
| xOrig | Coordinate (in pixels) at the leftmost edge of the screen. Recommended value range: 0.0f ≦ xOrig < 640.0f. |
|---|---|
| yOrig | Coordinate (in pixels) at the topmost edge of the screen. Recommended value range: 0.0f ≦ yOrig < 528.0f. |
| wd | Width of the viewport (in pixels). Recommended value range: 0.0f < wd ≦ (640.0f - xOrig). |
| ht | Height of the viewport (in pixels). Recommended value range: 0.0f < ht ≦ (528.0f - yOrig). |
| nearZ | Floating point value for the near side of the depth scale. The normalized range is from 0.0f to 1.0f. |
| farZ | Floating point value for the far side of the depth scale. The normalized range is from 0.0f to 1.0f. |
None.
This function sets the viewport rectangle in screen coordinates. The screen origin (xOrig = 0.0f, yOrig = 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 GXSetViewportJitter. The viewport depth parameters are normalized coordinates from 0.0f to 1.0f. The GX API will convert the depth range values to the correct scale values depending on the type and format of the Z buffer.
Values for xOrig, yOrig, wd and ht should be within the recommended value ranges. As an example, avoid using negative values for xOrig or yOrig. 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 GXSetScissorBoxOffset function instead.
The GXInit function initializes the viewport using the function below (rmode is a pointer to the default video mode).
GXSetViewPort( 0.0f, 0.0f, // xOrig, yOrig
rmode->fbWidth, rmode->xfbHeight, // width, height
0.0f, 1.0f); // nearZ, farZ
The viewport is typically set using parameters derived from the current render mode. See Render Modes.
GXSetScissor, MTXFrustum, Render Modes
2006/03/01 Initial version.
CONFIDENTIAL