Here are some notes on how the TMUs are initialized for rendering
the 9 textures in the borg demo.  This should be enough that you can
program up a similar program yourself.  I only document the glide calls
used for controlling the texture and color combine units and the alpha
blend functions.

Pass1
-----
For the first two textures (1 and 2):
  grHints(GR_HINT_STWHINT,GR_STWHINT_ST_DIFF_TMU1);
  guTexCombineFunction( GR_TMU1, GR_TEXTURECOMBINE_DECAL );
  guTexCombineFunction( GR_TMU0, GR_TEXTURECOMBINE_MULTIPLY );
  // set up color combine to display texture modulated with constant RGB
  guColorCombineFunction( GR_COLORCOMBINE_TEXTURE_TIMES_CCRGB );

I then call grConstantColorValue() with the result of simple diffuse lighting
for each polygon face.

Pass2
-----
For the next two textures (3 and 4), I do the same as above except there's
no lighting and I add into the framebuffer (note special alphablending mode
that results in 2*src*dst):

  guColorCombineFunction( GR_COLORCOMBINE_DECAL_TEXTURE );
  grAlphaBlendFunction(GR_BLEND_DST_COLOR,GR_BLEND_SRC_COLOR,
                       GR_BLEND_ONE,GR_BLEND_ZERO);


Pass3
-----
The glow textures (5 and 6) are added together and then added 
into the framebuffer:
  guTexCombineFunction( GR_TMU1, GR_TEXTURECOMBINE_DECAL);
  guTexCombineFunction( GR_TMU0, GR_TEXTURECOMBINE_ADD);
  guColorCombineFunction( GR_COLORCOMBINE_DECAL_TEXTURE );
  grAlphaBlendFunction(GR_BLEND_ONE,GR_BLEND_ONE,GR_BLEND_ONE,GR_BLEND_ZERO);


Pass4
-----
The projected spotlight is simply added into the framebuffer, note that
because it is a projected texture, W is different in TMU0:
  grHints(GR_HINT_STWHINT,GR_STWHINT_W_DIFF_TMU0);
  guTexCombineFunction( GR_TMU1, GR_TEXTURECOMBINE_ZERO );
  guTexCombineFunction( GR_TMU0, GR_TEXTURECOMBINE_DECAL );
  guColorCombineFunction( GR_COLORCOMBINE_DECAL_TEXTURE );
  grAlphaBlendFunction(GR_BLEND_ONE,GR_BLEND_ONE,GR_BLEND_ONE,GR_BLEND_ZERO);
and when I am done, I return the hints to normal:
  grHints(GR_HINT_STWHINT,GR_STWHINT_ST_DIFF_TMU1);
One could make an argument that this pass should be last, as the spotlight
should also light up the windows.  However, note that lighting up (diffuse) is 
different than reflecting (specular).

Pass5
-----
And finally the reflective windows, where I use two textures mostly for
convenience. The alpha in TMU1 defines where the windows are, envmatt.ppm
is an RGB texture that I process after I read it in - wherever there's
color I set Alpha=0xFF.  The other texture is a nebula texture.  An 
alternative method would be to pair up one of the ship detail textures 
with this reflective texture and use a 1555 ARGB ship texture.  This requires
the ship texture to be repeated the right amount, and then the glow
textures must follow this pass, which means the windows cannot "cut out"
the lights:
  // RGB from tmu0, Alpha from TMU1
  guTexCombineFunction( GR_TMU1, GR_TEXTURECOMBINE_DECAL );
  grTexCombine( GR_TMU0, GR_COMBINE_FUNCTION_LOCAL, GR_COMBINE_FACTOR_NONE,
                  GR_COMBINE_FUNCTION_SCALE_OTHER, GR_COMBINE_FACTOR_ONE,
                  FXFALSE, FXFALSE );
  guColorCombineFunction( GR_COLORCOMBINE_DECAL_TEXTURE );
  // alpha=0xFF where we want reflection
  grAlphaBlendFunction(GR_BLEND_SRC_ALPHA,GR_BLEND_ONE_MINUS_SRC_ALPHA,
                       GR_BLEND_ONE,GR_BLEND_ZERO);


I usually hate using gu* functions, but in this case they are just too
convenient.  There's a straight translation to gr* functions.

