N64® Functions Menu

al - Audio Library Functions
gDP - DP GBI Macros
gdSP - General GBI Macros
gSP - SP GBI Macros
gt - Turbo Microcode RDP
gu - Graphics Utilities
Math - Math Functions
nuSys - NuSystem
os - N64 Operating System
sp - Sprite Library Functions
uh - Host to Target IO
64DD - N64 Disk Drive

Nintendo® Confidential

## gSPViewPort

Syntax

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

Arguments

- gdl is the display list pointer.

- v is the segment address to the viewport structure "Vp".

- vscale is the scale applied to the normalized homogeneous coordinates after 4x4 projection transformation.

- vtrans is the offset added to the scaled value.

Explanation
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 3-3-4, "The View Coordinate System" in Step 3 of the Kantan Manual.

Comment
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
2/1/1999 Completely rewritten.

Nintendo® Confidential Warning: all information in this document is confidential and covered by a non-disclosure agreement. You are responsible for keeping this information confidential and protected. Nintendo will vigorously enforce this responsibility.
Copyright © 1998
Nintendo of America Inc. All rights reserved
Nintendo and N64 are registered trademarks of Nintendo
Last updated March 1999