Blending Question
No matter how many times I try, I can't seem to find values for glBlendFunc that make the blending look right. I've tried GL_ONE, GL_SRC_ALPHA and some other suggestions online, but can't seem to find anything that works right. I've even looked at the math, and it seems like it should work but doesn't. Anyone have any suggestions? I don't want anything fancy, just full opacity when the alpha value is 1.0f and complete transparency when it's 0.0f.
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
Should work [grin]
Regards,
ViLiO
Should work [grin]
Regards,
ViLiO
If thats what you want you should rather consider ALPHA_TESTING
Because Blending still writes to the depth buffer even at 0% Visibility..
Heres how to set it up assuming you loaded the ALPHA_CHANNEL of the texture correctly
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER,0.9f); // This says that if ur alpha channels is greater than 90% Invisible then discard the fragment...
// If it appears inverted change GL_GREATER --> GL_LESS and 0.9f --> 0.1f
Because Blending still writes to the depth buffer even at 0% Visibility..
Heres how to set it up assuming you loaded the ALPHA_CHANNEL of the texture correctly
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER,0.9f); // This says that if ur alpha channels is greater than 90% Invisible then discard the fragment...
// If it appears inverted change GL_GREATER --> GL_LESS and 0.9f --> 0.1f
----------------------------http://djoubert.co.uk
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement