Skip to content

Instantly share code, notes, and snippets.

@smukkejohan
Created November 5, 2014 15:01
Show Gist options
  • Save smukkejohan/826c93ca846f2e70773b to your computer and use it in GitHub Desktop.
Save smukkejohan/826c93ca846f2e70773b to your computer and use it in GitHub Desktop.
Simple crossfade shader gl2 GLSL version 120
#version 120
uniform sampler2DRect tex0;
uniform sampler2DRect tex1;
uniform vec2 aTexSize;
uniform vec2 bTexSize;
uniform float fadeToB;
varying vec2 texCoordVarying;
void main()
{
vec4 a = texture2DRect(tex0, texCoordVarying * aTexSize);
vec4 b = texture2DRect(tex1, texCoordVarying * bTexSize);
vec4 color = vec4(1.0, 1.0, 1.0, 1.0);
color = mix(a, b, fadeToB);
gl_FragColor = color;
}
#version 120
varying vec2 texCoordVarying;
void main()
{
texCoordVarying = gl_MultiTexCoord0.xy;
gl_Position = ftransform();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment