A problem with blending

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.

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.

Thanks a lot. I’ll check it out!

…? 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?

It’s glAlphaFunc.