2D Texture Alpha Transparency

Started by
1 comment, last by Erondial 18 years ago
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?
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.
... I brought it down from 65x65 to 64x64 in paint... and paint doesn't support alpha channels. Argh. Okay. Thanks :)

This topic is closed to new replies.

Advertisement