Skip to content

Instantly share code, notes, and snippets.

@chrisdickinson
Created December 2, 2012 02:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisdickinson/4186707 to your computer and use it in GitHub Desktop.
Save chrisdickinson/4186707 to your computer and use it in GitHub Desktop.
interleaving two fragment shaders: http://glsl.heroku.com/e#5174.0
precision highp float;
uniform float time;
uniform vec2 mouse;
uniform vec2 resolution;
#pragma glslify: balls = require(./balls, time=time, mouse=mouse, resolution=resolution)
#pragma glslify: sauron = require(./sauron, time=time, mouse=mouse, resolution=resolution)
int modulo(float x, float y) {
return int(x - y * floor(x / y));
}
void main(void) {
ivec2 m = ivec2(modulo(gl_FragCoord.x, 2.), modulo(gl_FragCoord.y, 2.));
if(m.x == 0 || m.y == 0) {
balls();
} else {
sauron();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment