Newsgroups: comp.sys.sgi
Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!eagle!monet.lerc.nasa.gov!xxdon
From: xxdon@monet.lerc.nasa.gov (Don Sosoka)
Subject: lighted, multi-colored polys
Message-ID: <1991Jun14.145543.23235@eagle.lerc.nasa.gov>
Originator: xxdon@monet.lerc.nasa.gov
Sender: news@eagle.lerc.nasa.gov
Organization: NASA/Lewis Research Center, Cleveland
Date: Fri, 14 Jun 1991 14:55:43 GMT
Lines: 51

I know this should be an easy one and the answer must be docummented some-
where but I can't find it.  Please Help!

I want to draw smooth (GOURAUD) shaded lighted polygons starting with   
different colors at each vertex.  Assuming the lighting model is setup 
correct (which it seems to be), if I do something like

      call SHADEM (GOURAU)
      call BGNPOL
      do 10 i = 1,N
         vn(1) = XN(i)
         vn(2) = YN(i)
         vn(3) = ZN(i)
         call N3F (vn)
         icv(1) = IRED(i)
         icv(2) = IGREEN(i)
         icv(3) = IBLUE(i)
         call C3I (icv)
         v(1) = X(i)
         v(2) = Y(i)
         v(3) = Z(i)
         call V3F (v)
10    continue
      call ENDPOL

I get smooth shaded colored polygons but no lighting effects.  If I reverse the
order:

      call SHADEM (GOURAU)
      call BGNPOL
      do 10 i = 1,N
         icv(1) = IRED(i)
         icv(2) = IGREEN(i)
         icv(3) = IBLUE(i)
         call C3I (icv)
         vn(1) = XN(i)
         vn(2) = YN(i)
         vn(3) = ZN(i)
         call N3F (vn)
         v(1) = X(i)
         v(2) = Y(i)
         v(3) = Z(i)
         call V3F (v)
10    continue
      call ENDPOL

I get a nicely lit surface but all gray shaded.

What's the trick? (or am I way off base).

Thank's.
