Problem with combining alpha channel to an existing texture
I have been trying to combine an alpha channel to an existing texture with no success. I do it this way:
Build the alpha channel (color components are zero) and the texture (alpha component is one) to combine it to into textures of GL_RGBA8 and GL_UNSIGNED_BYTE then
glEnable(GL_BLEND);
// Draw alpha
glBlendFunc(GL_ONE, GL_ZERO);
glBindTexture(...);
glBegin(...);
...
glEnd();
// Draw texture
glBlendFunc(GL_DST_ALPHA, GL_ZERO); // (*)
glBegin(...);
...
glEnd();
glBindTexture(...);
Then another texture can be drawn with the blend function (GL_ONE_MINUS_DST_ALPHA, GL_ONE);
The problem is that GL_DST_ALPHA simply has no effect as the texture is drawn in full intensity. It seems to me that alpha values are not recorded in OpenGL's buffers unless specified by glColor*().
Your framebuffer has to support an alpha channel for that to work.
If at first you don't succeed, redefine success.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement