uniform sampler2D texture;
varying vec2 vTexCoord;
uniform float strength;
uniform float slider;
uniform float glitch;
uniform float time;

vec2 samples[12];

void main(void)
{  

   vec2 newCoord;
   newCoord = vTexCoord; 
   newCoord.x = newCoord.x + 0.006;
   newCoord.y = newCoord.y + 0.0035;


  
   samples[0]  = vec2(-0.326212, -0.405805);
   samples[1]  = vec2(-0.840144, -0.073580);
   samples[2]  = vec2(-0.695914,  0.457137);
   samples[3]  = vec2(-0.203345,  0.620716); 
   samples[4]  = vec2( 0.962340, -0.194983);
   samples[5]  = vec2( 0.473434, -0.480026);
   samples[6]  = vec2( 0.519456,  0.767022);
   samples[7]  = vec2( 0.185461, -0.893124);
   samples[8]  = vec2( 0.507431,  0.064425);
   samples[9]  = vec2( 0.896420,  0.412458);
   samples[10] = vec2(-0.321940, -0.932615);
   samples[11] = vec2(-0.791559, -0.597705);

   vec4 offset = texture2D(texture, vec2(newCoord));

   vec2 newCoord2 = vTexCoord;
   newCoord2.y = newCoord2.y + ((sin(cos((time)/3.0+(newCoord.x)*10.0)*2.0)*0.01)*glitch);

   vec4 sum = texture2D(texture, vec2(newCoord2));



   for (int i = 0; i < 12; i++)
   {
      offset += texture2D(texture, vec2(vTexCoord)+slider * samples[i]) ;   
   }

   offset /= 12.0;

   offset.r = offset.r * 1.5;
   offset.g = offset.g * 0.3;
   offset.b = offset.b * 0.5;

   offset = offset *  (1.0+strength);

   
   gl_FragColor = vec4(sum + (offset*0.8));
}