patriciogonzalezvivo/glslCanvas

Safari ignores alpha channel of gl_FragColor

alecmolloy opened this issue · 0 comments

Code: (same as default code, but with a 0.25 value for alpha channel)

// Author:
// Title:

#ifdef GL_ES
precision mediump float;
#endif

uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_time;

void main() {
    vec2 st = gl_FragCoord.xy/u_resolution.xy;
    st.x *= u_resolution.x/u_resolution.y;

    vec3 color = vec3(0.);
    color = vec3(st.x,st.y,abs(sin(u_time)));

    gl_FragColor = vec4(color,0.25);
}

Browsers in screenshot below, left to right:

  1. Safari Technology Preview Release 71 (Safari 12.1, WebKit 14607.1.15)
  2. Safari Version 12.0 (14606.1.36.1.9)
  3. Chrome Canary Version 73.0.3642.0 (Official Build) canary (64-bit)

screenshot 2018-12-17 at 12 29 51

I cannot understand why this is happening, but it seems to be that alpha is output as 1.0 for gl_FragColor values greater than approximately 0.002197265508584, and as 0.0 for values below. (e.g. 0.0001 is interpreted as 0.0).