lighted, multi-colored polys

Reuel Nash reuel at khaki.asd.sgi.com
Sat Jun 15 02:44:31 AEST 1991


In article <1991Jun14.145543.23235 at eagle.lerc.nasa.gov>, xxdon at monet.lerc.nasa.gov (Don Sosoka) writes:
> I want to draw smooth (GOURAUD) shaded lighted polygons starting with   
> different colors at each vertex.

You're real close with the second loop. You need to call lmcolor to tell
the graphics system what to do with the C3I calls. In "C" it would
be:
	lmcolor(LMC_AD);

>       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
> 

BTW, this can go LOTS faster if you can arrange to not copy the color, normal,
and vertex data, but use it where it is. I don't know how to do this in 
FORTRAN, but in "C" it would be:

float v[MAXN][3], c[MAXN][3], nm[MAXN][3];
	.
	.
	.

bgnpolygon();
for(i = 0; i < MAXN; i++) {
	c3f(c[i]);
	n3f(n[i]);
	v3f(v[i]);
}
endpolygon();


Reuel Nash				Email:		reuel at sgi.sgi.com  
"Question Skepticism"			Voicemail:	x8749 
Mail stop:SR-254 Work Phone:(713)266-1333 Home Phone:(713)589-6258
USMail:	 Silicon Graphics, 5858 Westheimer Suite 100, Houston, TX  77057



More information about the Comp.sys.sgi mailing list