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

## gDPSetDepthSource [macro]

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 is the display list pointer.

- source is the 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

- delta Z value)

Explanation
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 Section 12.7.6, "Depth Source" and Section 15.5.8, "Z Calculation," in the N64 Online Programming Manual.

Example
When the flag is set to G_ZS_PRIM, you must use a Z-enabled rendering mode. The only modes that 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
2/1/99 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-1999
Nintendo of America Inc. All rights reserved
Nintendo and N64 are registered trademarks of Nintendo
Last Updated April, 1999