Just to clarify: do you want the fragments with alpha = 0.0 not to be recorded either in colorbuffer or in depth? Also, I assume that you are using blending to mask transparent pixels, because otherwise it should not be a problem.
In this case, you can simply discard the fragment in your fragmentshader:
if( color.a<=0.0 ){ discard; }
This ensures that all fragments for which the condition is true will not be displayed at all (instead of being mixed with a zero coefficient on the framebuffer).
If you (for some reason) program a fixed pipeline, you can use the alpha test to get the same behavior (personally, I would suggest switching to a direct compatible (implying a shader) path, but itβs not).
glEnable(GL_ALPHA_TEST); glAlphaFunc(GL_GREATER,0.0f);
As an added bonus, since these methods kill the fragment rather than making it invisible, it can be faster than mixing (although I have not looked at it recently, so itβs possible, but in general it should not be slower, so itβs still a plus)
source share