Created
November 24, 2012 13:24
-
-
Save Hamcha/4139693 to your computer and use it in GitHub Desktop.
Simple music visualizer for Live-Coder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uniform vec2 resolution; | |
uniform float lowFreq, midFreq, highFreq; | |
uniform float time; | |
vec3 circle(vec2 root, vec2 position, float radius, vec3 color) | |
{ | |
if (distance(position, root) < radius) return color; | |
return vec3(0); | |
} | |
void main( void ) { | |
vec2 p = -1.0 + 2.0 * ( gl_FragCoord.xy / resolution.xy ); | |
p.x *= resolution.x / resolution.y; | |
vec3 color = vec3(0); | |
color += circle(mod(p,0.5)-.25, vec2(0,0), lowFreq*2., vec3(1.,0,0)); | |
color += circle(mod(p,1.)-0.5, vec2(0,0), midFreq*10., vec3(0,1.,0)); | |
color += circle(p, vec2(0,0), abs(highFreq*105.*p.x), vec3(0,0,1.)); | |
gl_FragColor = vec4(color,1.0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment