Opaque patterns

Gary Tarolli tarolli at westcoast.esd.sgi.com
Fri May 10 00:33:56 AEST 1991


In article <1991May8.202442.21658 at murdoch.acc.Virginia.EDU>, acl3k at topaz.cs.Virginia.EDU (Allan Christian Long) writes:
> Could someone please tell me how to do opaque patterns?  Here's what
> I mean:  I have defined a pattern with defpattern.  When I draw
> filled primitives with that pattern set, pixels corresponding to
> 1's in the pattern get set to the current color and pixels
> corresponding to 0's in the pattern are unchanged.  Sometimes
> this is what I want.  BUT, sometimes I want the 1's in the
> pattern set to one color, and the 0's set to a different color.
> 	I have tried various things, such as drawing the primitive
> once with logicop(LO_NSRC) in one color and again with logicop(LO_SRC)
> in a different color, but I end up with the same thing as if I
> had just drawn it the second way.
> 	I guess I could invert the pattern myself and use two
> different patterns to get what I want, but I was hoping there
> would be an easier way.
> 	Thanks in advance for any help.
> 
The only way I know how to do this is to invert the pattern as you suggested
and draw the polygon again.  Switching patterns every polygon is not
efficient, so if you can draw all your polygons and then switch patterns
and redraw all your polygons yhou will be better off.  

What you need is a choice between transparent and opaque patterning (and
lien stippling).  This also requires a way to set the background color
that would get displayed when there is a 0 in the pattern.  I will
raise this issue internally to GL developers for future GL releases....
However, this kind of 2-D patterning is more in line with X graphics
than GL graphics...

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



More information about the Comp.sys.sgi mailing list