Advertisement

Problem with combining alpha channel to an existing texture

Started by June 26, 2004 04:45 AM
1 comment, last by frkstyc 20 years, 5 months ago
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.
Advertisement
Quote: Original post by python_regious
Your framebuffer has to support an alpha channel for that to work.


Oh thank you so much! It was my fault to have read GLUT's specification so carelessly as to neglect that GLUT_RGBA <> GLUT_RGB(A) + GLUT_ALPHA. Thanks again for your help.

This topic is closed to new replies.

Advertisement