PDA

View Full Version : A problem with blending



Orzech
12-05-2002, 10:56 PM
It goes like that - I've texturized my shapes but I wanted to make them transparent for objects. I mean the black color shouldn't be drawn because quad-like figures are not the best shape for bitmap ovals. So what is wrong? The quad is transparent all the time - pixels which are not black just change color when some other object fly above them. How to avoid it? (read : I just want to make only black pixels transparent).

PS. Sorry for my english.

MickeyMouse
12-06-2002, 12:28 AM
glBlendFunc(GL_ONE, GL_ONE) will make black pixels in your object invisible, however all others will be blended..

If you want black ones to be invisible and all others replacing, you can use alpha channel to fill it with say 0 (for black pixels) and 1 (for any other color). Then performing alpha test like glAlphaTest(GL_NOTEQUAL, 0) should work for you.

Also note that if you use blending with alpha testing you need to sort by hand transparent faces before drawing them.

Orzech
12-06-2002, 09:16 AM
Thanks a lot. I'll check it out!

Orzech
12-07-2002, 06:12 AM
...? I don't know what's wrong. Meaby I've misunderstood what you've said but I don't have any function like glAlphaTest. Could anybody help me?

Bob
12-07-2002, 06:26 AM
It's glAlphaFunc.