Skip to content

Instantly share code, notes, and snippets.

@kennygoff
Last active June 30, 2020 18:23
Show Gist options
  • Save kennygoff/19ee4d646edb5f0eec44bbdc5a7808f6 to your computer and use it in GitHub Desktop.
Save kennygoff/19ee4d646edb5f0eec44bbdc5a7808f6 to your computer and use it in GitHub Desktop.
uniform sampler2D swapTexture;
uniform bool shaderIsActive;
void main()
{
vec4 pixel = texture2D(bitmap, openfl_TextureCoordv);
if (!shaderIsActive)
{
gl_FragColor = pixel;
return;
}
vec2 index = vec2(pixel.r, pixel.g);
vec4 swapPixel = texture2D(swapTexture, index);
if(pixel.a != 0.0 && swapPixel.a != 0.0) {
pixel = swapPixel;
}
gl_FragColor = pixel;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment