mirror of
https://github.com/processing/processing4.git
synced 2026-01-30 03:41:15 +01:00
Adding the shader examples
This commit is contained in:
12
java/examples/Topics/Shaders/ImageMask/data/mask.glsl
Normal file
12
java/examples/Topics/Shaders/ImageMask/data/mask.glsl
Normal file
@@ -0,0 +1,12 @@
|
||||
uniform sampler2D textureSampler;
|
||||
uniform sampler2D maskSampler;
|
||||
|
||||
uniform vec2 texcoordOffset;
|
||||
varying vec4 vertColor;
|
||||
varying vec4 vertTexcoord;
|
||||
|
||||
void main() {
|
||||
vec4 texColor = texture2D(textureSampler, vertTexcoord.st).rgba;
|
||||
vec4 maskColor = texture2D(maskSampler, vec2(vertTexcoord.s, 1.0 - vertTexcoord.t)).rgba;
|
||||
gl_FragColor = mix(texColor, vec4(0, 0, 0, 0), 1.0 - maskColor.r);
|
||||
}
|
||||
Reference in New Issue
Block a user