The procedure you follow to produce highlights is explained in the Programming Manual in Chapter 11.7.4, "Specular Highlights," so here we will give just a simple explanation using the source from the gfx9.c sample program.
Whereas the Programming Manual presents sample code to position two highlight light-sources, the gfx9.c sample program makes use of only one highlight. Thus, you will probably want to look at gfx9.c to see how to position just one highlight light-source.
To perform lighting using highlights, you define the LookAt type variable and Hilite type variable, and pass these to the guLookAtHilite function and initialize. The guLookAtHilite function takes a number of arguments, but none are very difficult to understand. For details, please see the Function Reference.
List 9-1 | |
|
9.4.2 Preparing the Light
Although the direction of the highlight light-source is specified in guLookAtHilite, you also need to define a light structure that points in the same direction. In the case of the gfx9.c sample program, diffuse light is also used at the same time as a highlight.
List 9-2 | |
|
9.4.3 Loading the Texture
g The texture coordinate scaling parameters and the primitive tile are specified in gSPTexture. G_TX_RENDERTILE, which is a macro constant defined in <gbi.h>, connotes Tile0. If you use either gDPLoadTextureBlock or gDPLoadTextureTile, then the texture will be automatically loaded to the G_TX_RENDERTILE tile. The color that is used for highlight color is the one set for primitive color.
List 9-3 | |
|
9.4.4 Other Commands
To use highlight textures, you also need to set the various modes with the following commands. Note that G_TEXTURE_GEN has been added to geometry mode.
List 9-4 | |
|
Figure 9-2 Screen shots of gfx9.c sample program with __HILITE__ defined.