10.2 Using Primitive Depth

In the gfx10.c sample program, a value of 0, which is the smallest Z value, is specified for the primitive Z in order to display the small texture rectangle as forward as possible.

List 10-3

  /* Make the cycle type 1-Cycle mode */
  gDPSetCycleType(glistp++, G_CYC_1CYCLE);
  /* Use texture color & alpha in combine mode  */
  gDPSetCombineMode(glistp++, G_CC_DECALRGBA, G_CC_DECALRGBA);
  /* Rendering mode  */
  gDPSetRenderMode(glistp++,G_RM_AA_ZB_TEX_EDGE, G_RM_AA_ZB_TEX_EDGE2);
  /* Set the Z value source  */
  gDPSetDepthSource(glistp++, G_ZS_PRIM);
  /* Set the Z value of the texture rectangle  */
  gDPSetPrimDepth(glistp++, 0, 0);

G_RM_AA_ZB_TEX_EDGE is used for the rendering mode. The TEX_EDGE mode is designed for billboard-type texture mapping. To learn details about the settings of this mode, see the definition for G_RM_AA_ZB_TEX_EDGE.