#version 120
varying vec2 texCoord;

uniform sampler2D colorMap;
//uniform int abc;
uniform float anim1;
uniform float anim2;
uniform float anim3;
uniform float anim4;
uniform float xs;
uniform float ys;
uniform float zoom;//64-256
uniform float factor;

uniform float testvalue;

void main (void)
{
vec4 color;
    float x=(texCoord.x)*1920;
    float y=(texCoord.y)*1080;
    float w=1.0f;
    float h=1.0f;
    float a1=anim1;
    float a2=anim2;
    float a3=anim3;
    float a4=anim4;
    float c1 =
    (x+factor*100*sin(a1+x/2000*6.28*4.0)+factor*100*cos(a3+x/2000*6.28*4.0)
      //+ 128.0 + (128.0 * sin(y / 32.0))
      //+ 128.0 + (128.0 * sin(sqrt(((x - w / 2.0)* (x - w / 2.0) + (y - h / 2.0) * (y - h / 2.0))) / 8.0 ))
      //+ 128.0 + (128.0 * cos(sqrt((x * x + y * y)) / 8.0+a2))
    ) /1920.0f; /// 4 /256.0f;

    float c2=
    (y+factor*100*cos(a2+y/1000*6.28*4.0)+factor*100*sin(a4+x/2000*6.28*4.0)
      //+ 128.0 + (128.0 * sin(y / 8.0+a3))
      //+ 128.0 + (128.0 * sin((y) / 16.0)+a4)
      //+ 128.0 + (128.0 * sin(sqrt((x * x + y * y)) / 8.0))
    ) /1080.0f;/// 4/256.0f;


    //plasma[y][x] = color;
	//gl_FragColor = texture2D(colorMap, texCoord);

	//color=vec4(c,c,c,1.0f);

	c1=clamp(c1,0,0.999);
	c2=clamp(c2,0,0.999);
	color=texture2D(colorMap,vec2(c1,c2)*testvalue);
	gl_FragColor=color;
}
