[comp.sys.sgi] Sample Programs using Lighting Models

richr@etl.ARPA (Richard Rosenthal) (05/05/88)

          <This package was filled by weight not volume.>
          
          Does anyone have any programs, including source code, that
          demonstrate the use of lighting models (lighting models as
          described in Graphics Library User's Guide, Chapter 14,
          Lighting Models) on SGI IRIS 4D/60T? 
          
          The programs liquid, light, and sdisp appear not to use
          these facilities.  Please, please, correct me if I am wrong
          or, better yet, explain how these programs work. 
          
          Obviously, I am trying to teach myself about lighting. 
          
          Thanks. 
-- 
Richard Rosenthal                            | ARPANET:  richr@etl.arpa
US Army Engineer Topographic Laboratories    | UUCP:     ???
Ft. Belvoir, VA 22060-5546                   | PHONE:    +1 202 355 2830

grose@camax01.UUCP (Larry Grose) (05/09/88)

A warning concerning SGI's implementation of their lighting model.  In
order to differentiate between when transformations are intended to modify
just the model and when they are intended to modify both the model and the
lights, they have added an mmode() call, which is described in section
14.4 of the Graphics Library User's Guide.  It claims that the calls
perspective, window, ortho, and ortho2 work under both MVIEWING and
MPROJECTION modes.

However, when I was out at their headquarters porting to the GT and
scratching my head over why my lighting model code no longer worked
(normals appeared to be reversed), I talked to one of their software
gurus, who helped implement the lighting model for the GT.  He pointed
out I wasn't using MPROJECTION mode with the above calls and I pointed him
to SGI's documentation.  He politely said 'ouch', and admitted that it was
wrong for the GT (ie, perspective, window, ortho, and ortho2 must be used
under MPROJECTION mode only).  Unfortunately, the buck apparently stopped
there, because the new documentation that came with 3.0 still has the same
error.  In the 4 examples provided in section 14.6 for using mmode, only
the first one will work on the GT (all 4 work for non-GT's).

To the best of my knowledge, the rest of the lighting model documentation
is correct, though admittedly it is not very tutorial in nature.