13.2 Example Display List

The following display list fragment uses GBI display list commands to render an object using a 16-bit RGBA texture map. The texture is loaded into TMEM using the LoadBlock command. The texture coordinates are perspective corrected. Note that the texture is allowed to wrap on 32-texel boundaries in the s and t directions. The texture filter bi-linearly interpolates the 2x2 texels output by the texture unit. Finally, the resulting texture color is multiplied by the object's shade color in the Color Combiner for each pixel of the object.

/* Enable textured poly generation in RSP */
gSPTexture(glistp++, 0x8000, 0x8000, G_TX_RENDERTILE, G_ON);
gDPSetTextureFilter(glistp++, G_TF_BILERP);
gDPSetTexturePersp(glistp++, G_TP_PERSP);
gDPSetCombineMode(glistp++, G_CC_MODULATERGB, G_CC_MODULATERGB);
/* Load Texture Block */
gDPLoadTextureBlock(glistp++, RGBA16dana, G_IM_FMT_RGBA,
                    G_IM_SIZ_16b, 32, 32, 0, G_TX_WRAP, G_TX_WRAP, 
                    5, 5, G_TX_NOLOD, G_TX_NOLOD);
/* render model display list */
gSPDisplayList(glistp++, mode1);

UP