Next we will analyze some of the sample source. For these explanations, the sample program basic3 will be used.
First, take a look at the static display lists rspinit_dl and rdpinit_dl in graphic.c.
Here are several important yet simple commands:
gsSPViewport(&viewport)
Provides the pointer to the viewport structure Vp and sets the projection transformation parameters necessary for the size of the display window and the display of polygons.
gsDPSetCycleType(G_CYC_1CYCLE)
Specifies the rendering mode. The number of pixels that you can fill at any one time and the usable drawing functions vary depending on the mode, but this is not important for our purposes now.
gsDPSetScissor(G_SC_NON_INTERLACE, 0, 0, SCREEN_WD, SCREEN_HT)
Specifies the area in which you can draw. This is the same as specifying the clipping area for the so-called clipping process. Note that if you omit this command, the screen image will not be displayed correctly.
You may have noticed a convention in the naming of these commands. The SP and DP in the names indicate commands for the RSP processor or the RDP processor. Also, the initials gs at the front of the name indicate these are commands for a static display list. Commands for a dynamic display list have only the initial g at the front of their names.
In general, commands have been prepared in two versions, g... and gs... for dynamic and static display lists. Since both types of commands operate in exactly the same way, we will not distinguish between them in subsequent explanations. Yet note that g... commands take one extra argument not required by gs... commands, namely, the address where the command should be stored. If you look at the g... commands appearing in graphic.c you will see that they all have glistp++ as the first argument.
Next, we will look at some of the basic commands found in the dynamic display list: