precision mediump float; attribute vec3 position; attribute vec2 tc; uniform mat4 projMat; uniform mat4 modelMat; uniform float secs; uniform int strlen; varying vec3 vPosition; varying vec2 vTextureCoord; void main(void) { gl_Position = projMat * modelMat * vec4( position.x + 150.0 - mod(50.0 * secs, 6.0 * float(strlen) + 300.0) + cos(secs * 3.0), (position.y - 4.5) * (.5 + 2.0 * cos(position.x + secs * 4.0)) + 20.0 * cos(position.x + secs * 2.0), position.z + 40.0 * cos(position.x + secs * 3.0), 1.0); vPosition = position; vTextureCoord = tc; }

precision mediump float; varying vec3 vPosition; varying vec2 vTextureCoord; uniform sampler2D texture; uniform float secs; /* Stolen from Sam Hocevar. See: * https://gamedev.stackexchange.com/a/59808 */ vec3 hsv2rgb(vec3 c) { vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); } void main(void) { vec4 t = texture2D(texture, vTextureCoord); gl_FragColor = vec4(hsv2rgb(vec3( vPosition.x * .01 + vPosition.y * .01 + secs * .5, 1.0, 1.0 )), t.a); }