gDPSetFillColor [Macro]



Sets the RDP fill color


#include <ultra64.h>        /* gbi.h */
gDPSetFillColor(Gfx *gdl, u32 c)
gsDPSetFillColor(         u32 c)


Display list pointer.
32-bit color value.


Sets the RDP fill color. The fill color is an internal color register of the memory interface (MI) in the RDP. 32-bit fill color is only used in fill mode. Because data is written at a rate of 64 bits per clock in fill mode, the 32-bit color data is written twice, 2 pixels each time, to make a block of 4 pixels (a 32-bit fill color composition of two different 16-bit pixels can be used for a "special effect"). To learn how to set the cycle type, see gDPSetCycleType. For more details, see Section 12.8.8 "Fill Color" in the N64 Programming Manual.


g*DPSetFillColor is used primarily to clear the color frame buffer and the Z buffer. To clear the Z buffer, first set the Z buffer address to the color frame buffer address and then execute the command.


Two color-packing macros are available to fill the color frame buffer and the Z buffer. GPACK_RGBA5551 (r,g,b,a) and GPACK_ZD (z,dz) clear these respective buffers by packing them with 16-bit color. The maximum Z buffer value is G_MAXFBZ (0x3fff). Both macros return 16 bits and generate a 32-bit fill color the second time they are used.


To fill the color frame buffer with red, you would use the following:

gDPSetFillColor(gp++, GPACK_RGBA5551(255,0,0,1)<<16 | 

Clearing the Z buffer with the maximum value looks like this:

gDPSetFillColor(gp++, GPACK_ZDZ(G_MAXFBZ, 0)<<16 | 

See Also

gDPFillRectangle, gDPSetAlphaCompare, gDPSetCombineMode, gDPSetCycleType, and gDPSetRenderMode

Revision History

02/01/99   Completely rewritten