PDA

View Full Version : transparent layer over transparent layer



markun
01-23-2003, 01:41 PM
Hi,
i want to draw an transparent overlay. For Ex wide lines. I want them to be transparent but when two transparent lines come over each other i dont want them to seem more shaded.
I mean if the overlay planes cross each other crossed places with have the same shaded color?
How can i do it?
which glBlendFunc paramters i should use?
Thanks all

rgpc
01-23-2003, 06:31 PM
Can't say I know for sure but you might want to look for alpha testing? (glAlphaFunc)

jwatte
01-23-2003, 08:04 PM
I believe he's looking for a coverage function, such that if his semi-transparent line has already drawn in an area, another line crossing that line won't get dual-blended.

For obvious reasons you can't do this for anti-aliased lines. The best you can do is sort of fake it with full-coverage destination alpha in a separate render target, and then blend the entire target onto the frame buffer.

For non-anti-aliased lines, you can do this with the stencil buffer; you only need a single bit of stencil:

clear stencil
set the mode to set stencil where you draw to the framebuffer
set test to not pass a fragment that has stencil set
draw all your lines with blending

No pixel will be blended twice in this scenario.

markun
01-23-2003, 11:40 PM
yes, thats what i want to do,
i have maps on background, and i am to draw
airway coridors on it transparently.
I think it will be bad if crossings will be
darker. I want them all be same shade blended.
I will try that stencil buffer idea.
thanks