[comp.sys.sgi] bitplane planeing

Dan Karron@UCBVAX.BERKELEY.EDU (04/29/91)

Is there any way to control the allocation of bit planes into OVERDRAW
mode ? I want to draw an intricate picture into the NORMALDRAW bitplanes, 
then draw various processed pixels from that image on top of it into the
OVERDRAW mode bitplanes. I need at least as many bitplanes as in the NORMALDRAW
bitplanes (24 bits for my application).

I want to be able to show how an image processing algorithm (a variant 
edge detection) draws line with respect to its base image.

Cheers!


Dan.
| karron@nyu.edu (e-mail alias )         Dan Karron, Research Associate      |
| Phone: 212 263 5210 Fax: 212 263 7190  New York University Medical Center  |
| 560 First Avenue                       Digital Pager <1> (212) 397 9330    |
| New York, New York 10016               <2> 10896   <3> <your-number-here>  |

rpaul@comanche.omni.co (Rodian Paul) (04/29/91)

Dan Karron writes:
> Is there any way to control the allocation of bit planes into OVERDRAW
> mode ? I want to draw an intricate picture into the NORMALDRAW bitplanes, 
> then draw various processed pixels from that image on top of it into the
> OVERDRAW mode bitplanes. I need at least as many bitplanes as in the 
> NORMALDRAW bitplanes (24 bits for my application).
> 
> I want to be able to show how an image processing algorithm (a variant 
> edge detection) draws line with respect to its base image.
> 

I'm pretty sure that the maximum no. of overlay planes on a VGX is 8 bits, 
and only 2 on a personal (but I may be wrong).

However, I have some old code kicking around somewhere, where I was able to
draw a 24bit picture into the Z-buffer of a personal, and still have 24bits 
left over for an image in NORMALDRAW planes. 

So in effect you can use the zbuffer planes for some kind of stencil 
(has Quantel got it's greedy paws on the "Alpha-Plane" in the US yet?) 
or matte.

A couple of other considerations are in order when it comes to using the
overlay planes. The first is that if your window is passed a REDRAW token
you will call reshapeviewport(), and probably do a clear() and redraw your
window. 

Normally the window manager takes care of cleaning up the position where your 
old window was located, however it doesn't handle the overlay planes. You 
just end up with junk in the overlay planes where your window used to be. 

A quick fix is to go into overdraw()/fullscrn() mode and perform a clear() 
and then reset the viewport afterwards. This isn't too considerate 
if more than 1 application is using the overlay planes. A more elegant 
approach is to set the scrnmask() to where your old window was when you enter 
fullscrn() mode, that way you are less likely to trash another application's
overlay planes. Another trick that helps is to queue INPUTCHANGE and clear
the overlay planes when the user moves out of your window, but that can have
a disconcerting effect visually, depending on what you're drawing.

Anyway, if you want a copy of the "zpic" code, gimme a yell and I'll dig
it out.

Cheers.
-------------------------------------------------------------------------------
rpaul%crow@ccut.cc.u-tokyo.ac.jp	phone: +81 (3) 5706-8357
ccut.cc.u-tokyo.ac.jp!crow!rpaul	  FAX: +81 (3) 5706-8437

kurt@cashew.asd.sgi.com (Kurt Akeley) (04/29/91)

In article <9104290717.AA16340@karron.med.nyu.edu>, Dan Karron@UCBVAX.BERKELEY.EDU writes:
|> 
|> Is there any way to control the allocation of bit planes into OVERDRAW
|> mode ? I want to draw an intricate picture into the NORMALDRAW bitplanes, 
|> then draw various processed pixels from that image on top of it into the
|> OVERDRAW mode bitplanes. I need at least as many bitplanes as in the NORMALDRAW
|> bitplanes (24 bits for my application).
|> 
|> I want to be able to show how an image processing algorithm (a variant 
|> edge detection) draws line with respect to its base image.

No hardware platform currently shipped supports RGB mode in either overlay
or underlay bitplanes.  This probably won't help in your case, but it's
good to keep in mind that if RGB overlay is desired, it can be accomplished
by simply moving the base image to the underlay planes, then drawing "overlay"
images into the normal framebuffer.  If the base image is static, it can
sometimes be compressed into a carefully selected 8-bit colormap.

-- Kurt