Your blending formula:
glBlendFuncSeparate(GL_ONE, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
...is set up for "pre-multiplied alpha blending". This means you're saying to the blending pipeline, "trust me, I've already multiplied the RGB components by alpha, so you don't have to do that step again".
The trouble is, you're not keeping that promise:
void main() { vec4 color = texture2D(texture, uv); color.a *= 0.0; gl_FragColor = color; }
This multiplies the alpha of the colour by zero, but does not propagate that multiplication into the RGB components. So even if the texture you're reading was in correct pre-multiplied format, the result of this code is not, unless the RGB was already zero anyway.
Solutions:
If you don't want to use pre-multiplied alpha, you can use "layer" blending instead:
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
This multiplies the RBG components of your fragment shader's output colour by its Alpha component as part of the blending step, so that zero multiplication propagates through to the colour channels as expected.
Or if you prefer to keep using pre-multiplied alpha blending to get the benefits described in the answer I linked above, you'll need to adjust your shader to ensure any multiplier you apply to the alpha channel also gets applied to the colour channels:
void main() { vec4 color = texture2D(texture, uv); float alphaMultiplier = 0.0; // Usually you want a non-zero value here. color *= alphaMultiplier; gl_FragColor = color; }
Note that alphaMultiplier gets applied to the whole color vector: r, g, b, and a components. This keeps the promise that the RGB channels have been pre-multiplied by the alpha value prior to output.
If your texture is not already in pre-multiplied alpha format, you'd instead do it like this:
void main() { vec4 color = texture2D(texture, uv); float alphaMultiplier = 0.0; // Usually you want a non-zero value here. color.a *= alphaMultiplier; // Apply pre-multiplication. color.rgb *= color.a; gl_FragColor = color; }