Skip to content

Instantly share code, notes, and snippets.

@xseignard
Created May 13, 2015 12:52
Show Gist options
  • Select an option

  • Save xseignard/b0ef469d24f3256211ca to your computer and use it in GitHub Desktop.

Select an option

Save xseignard/b0ef469d24f3256211ca to your computer and use it in GitHub Desktop.
// automatically set by OF
attribute vec4 position;
attribute vec2 texcoord;
uniform mat4 modelViewProjectionMatrix;
// varying that will be passed to the fragment shader
varying vec2 vUv;
// noop vertex shader
void main() {
vUv = texcoord;
gl_Position = modelViewProjectionMatrix * position;
}
@xseignard

Copy link
Copy Markdown
Author
// uniforms passed from our update routine
uniform vec2 resolution;
uniform float time;
uniform sampler2D videoTexture;

// varying recieved from the vertex shader
varying vec2 vUv;

// fade effect
void main() {
    vec2 uv = vUv.xy / resolution.xy;
    vec3 a = texture2D(videoTexture, uv).rgb;
    vec3 b = vec3(0.0, 0.0, 0.0);
    vec3 m = mix(a, b, abs(sin(time)));
    gl_FragColor = vec4(m, 1.0);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment