Masking question

Hi there!

My problem is the following: I have an object loading and drawing class already working, and i don’t want to implement depth sorting for my polygons, but i want to draw tree branches with black and withe alpha masks. I understend why depth ordering necessary for blending but in this case i have no transparent pixels just masked or non masked, so is it somehow possible to mask the depthbuffer with my black and withe image mask? or is there any other way to draw masked faces without depth ordering?

Thanks, a lot!

Stencil buffer with depth test as well.

Sounds like a perfect job for the alpha test. Set the alpha of the texture to white for opaque parts and black for transparent parts. Then enble alpha test and call glAlphaTest with appropriate parameters (look it up). Bingo.

Thaks guys! Writing a TGA loader, changing texturing mode to glmodulate and useing alphatest does the work. Thanks for your help!

p.s.: sorry for my poor english