color interpolation and depth cueing?

Gary Tarolli tarolli at westcoast.esd.sgi.com
Fri Apr 5 04:29:16 AEST 1991


In article <1991Apr4.165218.11546 at dsd.es.com>, pmartz at undies.dsd.es.com (Paul Martz) writes:
> I have a program which draws several lines, color interpolating
> between vertices, which works just fine. But then I decided to add
> depth cueing to the program, with these function calls:
> 
> 		depthcue (TRUE);
> 		glcompat (GLC_ZRANGEMAP, 1);
> 		lsetdepth (0, 0x7fffff);
> 		lRGBrange (0, 0, 0, 255, 255, 255, 0, 0x7fffff);
> 
> and now it depth cues, but suddenly, the color interpolation has
> stopped working altogether. As a matter of fact, ALL color in the
> lines is gone, and they are instead rendered as shades of grey. This
> is not what I'd expect to happen in depth cue mode. A red line which
> is depth cued should just be a darker shade of red, right? Yet now
> that I have depth cueing enabled, the fact that I've set different
> colors on each vertex seems to be completely ignored.
> 
> What have I done wrong here? Surely it's possible to do this. Any help
> is appreciated. (ps -- using a Personal Iris GT, system 3.3.1)
> -- 

Yes, its possible to do what you want.  The reason the red lines turn grey
is because depthcueing is implemented such that it overrides the color
commands (just as lighting does).  Thus the fact that you have chosen
color red is meaningless (just like it is when you are lighting).  What
counts for depthcueing is the color(s) given to the lRGBrange command, in
this case black<->white (for lighting what matters is the material's color).

In other words, you must use the lRGBrange command to control the color
when depthcueing.  If your code draws in both depthcue mode and non-depthcue
mode, then one way to do this is to always call both color() and lRGBrange()
together.  A more efficient way would be to set a flag indicating which
mode you are in and then test the flag and call the appropriate color command.
Ditto if you are using lighting.

Unfortunately, it is not possible to depthcue a colored line (ie. one that
has a different color at each vertex).  Or maybe it is - if you call
lRGBrange between the 2 vertices, it may do what you want.  However, note
that lRGBrange is not a terribly fast routine like color is, and also
that if the line gets clipped, things may go bonkers because some of our
machines re-depthcue clipped lines (using the latter lRGBrange settings).
 
 


--------------------
	Gary Tarolli



More information about the Comp.sys.sgi mailing list