Original Post
I''m trying to get my text class fully working, but I''ve run into some unexpected difficulties with the alpha testing. First of all, let me tell you what I have. I have a full image of the font I''ll be using, along with an alpha channel to mask the areas I want to appear as transparent, all stored in a TGA file and being loaded by my program. I know the lapha channel is there, and I know it''s being successfully loaded. I checked the file myself manually, and it''s storing RGBA components for each pixel, and I also doublechecked the first few pixels as the TGA loader was reading them. The alpha channel itself consists of only full opacity and zero opacity values. There are no semi-transparent pixels.
Now, I can get the thing to work if I use blending, specifically using the lines:
glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);However, if my undersanding of how alpha testing works is correct, I shouldn''t have to resort to using a blend at all. This should work fine:
glEnable(GL_ALPHA_TEST); glAlphaFunc(GL_GREATER, 0.0);When I use this however, The whole image is rendered, as well a the parts that should be discarded by the alpha test. I know the test is working however, as if I set glAlphaFunc to somthing like == 0.5 then rescale all the alpha components in the texture using the glColor command, it has the same affect of rendering the whole image. It seems that the alpha test seems to think that every alpha value is set to 1.0, while the blending function works correctly. I''ve spent a few days running around in circles, testing everything I can think of and reading and re-reading every command definition in the referance manual, but I can''t for the life of me figure out why this isn''t working. As far as I can tell it should be. If anyone has any idea where I could be going wrong, please let me know.