gSPViewport

gSPViewport [Macro]

Function

gSPViewport

Sets the viewport area

Syntax

#include <ultra64.h>        /* gbi.h */
gSPViewport(Gfx *gdl, Vp *v)
gsSPViewport(         Vp *v)

Arguments

gdl
the display list pointer.
v
the segment address to the viewport structure "Vp".
vscale
the scale applied to the normalized homogeneous coordinates after 4x4 projection transformation.
vtrans
the offset added to the scaled value.

Description

Sets the viewport area. The viewport structure elements have a 2-bit fraction required for scaling to sub-pixel positions. This can be used to handle the fraction values in the viewport.

vscale, vtrans are the screen coordinates. The array indices 0, 1, 2 correspond to x, y, z, while array index 3 is used for the alignment.

The viewport is the area the image occupies on the screen. For details, see Section 1-3-4, "The View Coordinate System" in Step 3 of the N64 Introductory Manual.

Note

The Vp structure is shown below:

typedef struct {
        short vscale[4];	/* Scale, 14.2 */
        short vtrans[4];	/* Transformation, 14.2 */
} Vp_t;
typedef union {
        Vp_t vp;
        long long int force_structure_alignment;
} Vp;

See Also

gDPSetScissor

Revision History

02/01/99 Entirely revised.