lighted, multi-colored polys

Don Sosoka xxdon at monet.lerc.nasa.gov
Sat Jun 15 00:55:43 AEST 1991


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.



More information about the Comp.sys.sgi mailing list