My program uses blending via glBlendFunc(GL_SRC_ALPHA, GL_ONE) to make a pleasent effect when the background is set to black with clearColor(0,0,0,1). When
the background is set to white with clearColor(1,1,1,1) the screen is blank white. I don’t know how to generate the same trasparency effect on the white background. Suggestions appreciated.
My program uses blending via glBlendFunc(GL_SRC_ALPHA, GL_ONE) to make a pleasent effect when the
Share
glBlendFunc(GL_SRC_ALPHA, GL_ONE)roughly translates into the following equation (the clamping happens at another place, technically)However if you cleared to while, the
Previous_Framebuffer_{Red,Green,Blue}are already at 1.0 and so all following will be clamped.So you need to modulate not only the incoming fragments, but also the previous ones:
which is done by
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)