Created
May 3, 2013 10:06
-
-
Save rgngl/5508325 to your computer and use it in GitHub Desktop.
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
#ifdef GL_ES | |
precision mediump float; | |
#endif | |
// burl figure | |
uniform vec2 resolution; | |
uniform float time; | |
const float Pi = 3.14159; | |
float sinApprox(float x) { | |
x = Pi + (2.0 * Pi) * floor(x / (2.0 * Pi)) - x; | |
return (4.0 / Pi) * x - (4.0 / Pi / Pi) * x * abs(x); | |
} | |
float cosApprox(float x) { | |
return sinApprox(x + 0.5 * Pi); | |
} | |
void main() | |
{ | |
vec2 p=(2.0*gl_FragCoord.xy-resolution)/max(resolution.x,resolution.y); | |
for(int i=1;i<50;i++) | |
{ | |
vec2 newp=p; | |
newp.x+=0.6/float(i)*sin(float(i)*p.y+time/20.0+0.3*float(i))+400./20.0; | |
newp.y+=0.6/float(i)*sin(float(i)*p.x+time/20.0+0.3*float(i+10))-400./20.0+15.0; | |
p=newp; | |
} | |
vec3 col=vec3(0.5*sin(3.0*p.x)+0.5,0.5*sin(3.0*p.y)+0.5,sin(p.x+p.y)); | |
gl_FragColor=vec4(col, 1.0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment