123456789101112131415161718192021222324252627282930 |
- #version 130
- varying vec2 tex_coord;
- varying vec2 mask_coord;
- uniform sampler2D texture;
- uniform sampler2D mask;
- void main()
- {
- float alpha;
- vec4 texel0, texel1;
- texel0 = texture2D(texture, tex_coord);
- texel1 = texture2D(mask, mask_coord);
- alpha = 1.0 - abs(texel0.r - texel1.r);
- if(alpha > 0.0)
- gl_FragColor = texel1 / alpha;
- gl_FragColor.a = alpha;
- }
|