I changed the blending mode:
gl.blendEquationSeparate(gl.FUNC_ADD, gl.FUNC_ADD); gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA);
This is the result:

Explanation:
When rendering immediately in the back buffer, the alpha channel is always set to 1.0 (unless you use a transparent canvas). Therefore, it does not matter how alpha is calculated.
When rendering first to the render buffer (texture), and then this prepared texture is used to render to the back buffer - you need to use different blending modes for alpha and rgb.
SRC_ALPHA and ONE_MINUS_SRC_ALPHA are used to mix RGB (multiply) depending on SRC and DESC alpha.
If the alpha channel is also multiplied, it will overlap the opaque pixels in places where the texture has transparent pixels. We need to sum the alpha of each pixel, not multiply.
So, for the alpha function, you need to set: ONE and ONE_MINUS_SRC_ALPHA so that ALPHA accumulates, not multiplies.
Luk: I don't speak English (sorry). If someone was so good as to βtranslateβ this explanation, I would be grateful.
l00k
source share