From a7fc2311a10a032cab0c8d290f5f878d6f40d98f Mon Sep 17 00:00:00 2001 From: langolierz Date: Sun, 8 Jul 2018 15:58:45 +1200 Subject: [PATCH] Create example_shader.shader --- dotfiles/example_shader.shader | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 dotfiles/example_shader.shader diff --git a/dotfiles/example_shader.shader b/dotfiles/example_shader.shader new file mode 100644 index 0000000..3334020 --- /dev/null +++ b/dotfiles/example_shader.shader @@ -0,0 +1,23 @@ +// copied from http://glslsandbox.com/e#47821.0 +#ifdef GL_ES +precision mediump float; +#endif + +#extension GL_OES_standard_derivatives : enable + +uniform float u_time; +uniform vec2 u_mouse; +uniform vec2 u_resolution; + +void main( void ) { + + vec2 position = ( gl_FragCoord.xy / u_resolution.xy ) + u_mouse / 4.0; + + float color = 0.0; + color += sin( position.x * cos( u_time / 15.0 ) * 80.0 ) + cos( position.y * cos( u_time / 15.0 ) * 10.0 ); + color += sin( position.y * sin( u_time / 10.0 ) * 40.0 ) + cos( position.x * sin( u_time / 25.0 ) * 40.0 ); + color += sin( position.x * sin( u_time / 5.0 ) * 10.0 ) + sin( position.y * sin( u_time / 35.0 ) * 80.0 ); + color *= sin( u_time / 10.0 ) * 0.8; + + gl_FragColor = vec4( vec3( color, color * 0.5, sin( color + u_time / 3.0 ) * 0.75 ), 1.0 ); +}