2D Texture Alpha Transparency
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?
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement