Take the following directives:
gl.colorMask(1, 1, 1, 0);
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUES_SRC_ALPHA);
When I put the above into my app, the first frame renders as if alpha weren’t a factor at all, but the second frame turns completely white.
I can understand the first frame rendering properly, if there’s nothing to blend it with. However, I don’t understand why the second frame would turn white. Do the mathematics support this, or is it more likely a bug in the GL driver?
My understanding of the blend function is that it looks like:
Red = Rs * As + Rd * (1 - As)
Obviously, that only applies to the Red channel, but the other channels should be calculated similarly. In any case, the blend function shouldn’t be affected by the destination alpha at all (according to the above formula), so mathematically speaking, I can’t see why it would produce white.
Also, it’s worth taking note that the transition to white happens in a single frame. There’s no incremental “step” towards white as you’d see with additive blending over time. Even with very low alpha values, it is always exactly the second frame that the rendered polygons turn completely white.
That’s all the detail I can think to provide on this issue. Very curious to hear an explanation, if any.