Advertisement

How to do blending using the alpha channel?

Started by January 04, 2001 07:57 AM
2 comments, last by Nazghul 24 years, 1 month ago
Hi! I''ve a texture with an alpha channel. The alpha channel consists only of 0.0f or 1.0f, or 0 and 255, like you wish. So every point in my texture that has a 1.0f as its alpha value should be drawn fully opaque, points with an alpha value of 0.0f shouldn''t be drawn. But when i use this texture, its blendet like a texture without an alpha channel. How can i get that working? Thanks for any response!
if that is so u shouldnt use blending but use the alpha test instead (its quicker)

glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 0.0 );

http://members.xoom.com/myBollux
Advertisement
Well, thanks that worked!

But now the Texture is''nt blured anymore. So it looks really
crappy. Is there Any way to do alpha blending using the alpha channel and to antialiase the remaining pixels?
blur your alpha channel slightly in a paint program thus alpha values are in the range (0.0 - 1.0)

and instaed of the alpha test do this

glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

are you using GL_LINEAR for yoor textures instead of GL_NEAREST

http://members.xoom.com/myBollux

This topic is closed to new replies.

Advertisement