Skip to content

Instantly share code, notes, and snippets.

@ayamflow
Created February 8, 2018 00:24
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ayamflow/f028819d1e585874e49728d0fc51ca30 to your computer and use it in GitHub Desktop.
Save ayamflow/f028819d1e585874e49728d0fc51ca30 to your computer and use it in GitHub Desktop.
Layer 2 textures on top of each other in GLSL
// https://stackoverflow.com/questions/24480901/libgdx-overlay-texture-above-another-texture-using-shader
vec4 layer(vec4 foreground, vec4 background) {
return foreground * foreground.a + background * (1.0 - foreground.a);
}
#pragma glslify: export(layer);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment