gDPSetDepthSource

gDPSetDepthSource [Macro]

Function

gDPSetDepthSource

Sets which depth source value to use for comparisons with the Z buffer

Syntax

#include <ultra64.h>        /* gbi.h */
gDPSetDepthSource(Gfx *gdl, u32 source)
gsDPSetDepthSource(         u32 source)

Arguments

gdl
Display list pointer.
source
Depth source value:
G_ZS_PIXEL (Use the Z value and deltaZ value repeated for each pixel)
G_ZS_PRIM (Use the primitive depth register's Z value and deltaZ value)

Description

Sets which depth source value to use for comparisons with the Z buffer.

The different depth source values are explained below:

G_ZS_PIXEL
Uses the Z value and deltaZ value repeated for each pixel for the comparison with the Z buffer. This is the standard procedure in applications that perform Z buffering.
G_ZS_PRIM
Uses the Z value and deltaZ value in the blender's primitive depth register (set with gDPSetPrimDepth) for the comparison with the Z buffer. In this case, every pixel in a triangle has uniform depth.

For details, see Sections 12.7.6 "Depth Source", 14.7.1 "Primitive Z Value" and 15.5.8 "Z Calculation" in the N64 Programming Manual.

Example

When the flag is set to G_ZS_PRIM, you must use a Z-enabled rendering mode. The only modes which are Z-enabled are 1-cycle mode and 2-cycle mode.

// Set cycle type
gDPSetCycleType(gp++, G_CYC_2CYCLE);
// Set rendering mode
gDPSetRenderMode(gp++, G_RM_AA_ZB_TEX_EDGE, G_RM_AA_ZB_TEX_EDGE2);
// Set depth source value
gDPSetDepthSource(gp++, G_ZS_PRIM);
// Set primitive depth
gDPSetPrimDepth(gp++, 0, 0);

See Also

gDPSetPrimDepth

Revision History

02/01/99 Completely rewritten.