N
N
NNn1312021-01-26 17:13:11
JavaScript
NNn131, 2021-01-26 17:13:11

Webgl 2: How to fix color distortion in alpha blending?

I use webgl 2 I draw
a simple triangle on Canvas, the shader is as simple as possible:

out vec4 Color;
void main(){
    Color = vec4(1, 0, 0, 0.01);
}

I use blending gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
. I expect that after several renders in a row I will get a red triangle
. But in some unexpected way, the triangle that turns red at first turns into a bright blue in an instant.
601022b7f3689854099312.gif
Here is an example: https://jsfiddle.net/sqfh9eLa/13/
How does it work and what am I doing wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
NNn131, 2021-01-26
@NNn131

It seems to be a bug of the OperaGx browser, in chrome everything works as expected

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question