In OpenGL for achieving a proper transparency effect I should use glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) but with that blending function an alpha parameter in glClearColor becomes meaningless. When I change an alpha parameter in glClearColor I still get the same effect. When can I use the alpha parameter in glClearColor? What kind of effects Can I achieve?
In OpenGL for achieving a proper transparency effect I should use glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) but
Share
glClearColorsets the color (and alpha value) a RGBA framebuffer will be cleared to withglClear(GL_COLOR_BUFFER_BIT). The framebuffer alpha value would be taken into account withGL_DST_ALPHAorGL_ONE_MINUS_DST_ALPHAblend functions.However your regular on-screen window framebuffer usually doesn’t carry an alpha value. Notable exceptions exist of course, for example transparent windows with the background shining through, but they’re a bit tedious to set up, and will still receive all mouse events, even if over “transparent” areas.
Framebuffers with an alpha channel are mostly of interest als render to texture targets.
So in your case, the clear color is of no particular interest for you. You’re much more likely interested in the 4th parameter of
glColor4for textures with an alpha channel.