I'm very new to OGL. I'm trying to get the fragment shader to show a png-image with transparency in it. So far I've managed to turn the transparent background in the image to black, the alpha channel then views in black, but how to I make the alpha channel transparent for real?
I've tried my best to figure it out on my own but it hasn't worked out. Please help?
Here's my code:
const fragment = `
precision highp float;
precision highp int;
uniform sampler2D tWater;
uniform sampler2D tFlow;
uniform float uTime;
varying vec2 vUv;
uniform vec4 res;
void main() {
vec3 flow = texture2D(tFlow, vUv).rgb;
vec2 uv = .5 * gl_FragCoord.xy / res.xy ;
vec2 myUV = (uv - vec2(0.5))*res.zw + vec2(0.5);
myUV -= flow.xy * (0.15 * 0.7);
vec3 tex = texture2D(tWater, myUV).rgb;
gl_FragColor = vec4(tex.r, tex.g, tex.b, 1.0);
}
`;
{