Sign in to follow this  
Erondial

2D Texture Alpha Transparency

Recommended Posts

Erondial    172
I'm sorry for dumping threads and problems on you guys, but I just don't know where to go from where I am... I've loaded my png into an unsigned character buffer, loaded that as a texture, clamped it to a quad, and everything's peachy, except that the area that's transparent, isn't. I've enabled bledning with glEnable(GL_BLENDING);, I've set the blending function with glBlendFunc(GL_SRC_ALPHA,GL_ONE);, and set the colour as such: glColor4f(1.0f,1.0f,1.0f,1.0f);... I loaded the texture with glTexImage2D(GL_TEXTURE_2D, 0, 4, structure->w, structure->h, 0, GL_RGBA, GL_UNSIGNED_BYTE, structure->data);, so yes, it DOES have an alpha channel... I just don't know what to do? Why isn't it working?

Share this post


Link to post
Share on other sites
Sumo    122
You may have loaded the texture with an alpha channel but is the alpha channel actually encoded in the png? Also, I tend to use glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA). You then keep depth testing on and draw things from back of the scene to front.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this