Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!elroy.jpl.nasa.gov!decwrl!sgi!tarolli@westcoast.esd.sgi.com From: tarolli@westcoast.esd.sgi.com (Gary Tarolli) Newsgroups: comp.sys.sgi Subject: Re: Opaque patterns Summary: opaque patterns Keywords: pattern, GL Message-ID: <102653@sgi.sgi.com> Date: 9 May 91 14:33:56 GMT References: <1991May8.202442.21658@murdoch.acc.Virginia.EDU> Sender: guest@sgi.sgi.com Organization: Silicon Graphics, Inc., Mountain View, CA Lines: 31 In article <1991May8.202442.21658@murdoch.acc.Virginia.EDU>, acl3k@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