#version 130

in vec4 color;
in vec2 tex;

uniform float musictime;
uniform float musicdata[256];
uniform sampler2D colormap; 

void main(void) { 

    float pi = 2*3.1415926535897932384626433832795;

   gl_FragColor = texture(colormap,tex);
   if (gl_FragColor.xyz == vec3(0.0)) discard;
    float zplotch = (2.0+sin(sqrt(pow(tex.s*10.0+musictime,2)+pow(tex.t * 20.0+ musictime,2))) + sin(musictime+sqrt(pow((1.0-tex.s)*30.0 + musictime,2)+pow(tex.t *5.0 + musictime,2))))/4.0;
    //if (zplotch > 0.90) zplotch = -zplotch;
    gl_FragColor *= vec4((sin(musictime)+1.0)/2.0, zplotch, 1.0-zplotch, 1.0);
    
    
 
}