Skip to content

Instantly share code, notes, and snippets.

@kylemcdonald
Created November 12, 2011 14:24
Show Gist options
  • Save kylemcdonald/1360582 to your computer and use it in GitHub Desktop.
Save kylemcdonald/1360582 to your computer and use it in GitHub Desktop.
one liner
/*
GLSL fragment shader implementing the one line synthesis pattern.
http://countercomplex.blogspot.com/2011/10/algorithmic-symphonies-from-one-line-of.html
*/
#extension GL_EXT_gpu_shader4 : enable
const int width = 512; // assumes you're drawing at 512x512
void main() {
int t = int(gl_FragCoord.y) * width + int(gl_FragCoord.x);
int c = t*5&(t>>7)|t*3&(t*4>>10);// miiro
gl_FragColor = vec4(vec3(float(c % 256) / 256.), 1.);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment