• Advertisement
Sign in to follow this  

2D Texture Alpha Transparency

This topic is 4321 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
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
... I brought it down from 65x65 to 64x64 in paint... and paint doesn't support alpha channels. Argh. Okay. Thanks :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement