TransparentNonPremultiplied.js 540 Bytes
Newer Older
1
const GL = require("gl-react");
2
const React = require("react");
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

const shaders = GL.Shaders.create({
  TransparentNonPremultiplied: {
    frag: `
precision highp float;

varying vec2 uv;
uniform sampler2D t;

void main () {
  gl_FragColor = vec4(texture2D(t, uv).rgb, 0.0);
}
`
  }
});

19 20
module.exports = GL.createComponent(
  ({ children: t, ...rest }) =>
21
  <GL.Node
22
    {...rest}
23
    backgroundColor="transparent"
24 25 26 27
    shader={shaders.TransparentNonPremultiplied}
    uniforms={{ t }}
  />,
{ displayName: "TransparentNonPremultiplied" });