//fbTEX1 + fbTEX3 to framebuffer
uniform float amp;
uniform float scroll;
uniform float scrolly;
varying vec2 texCoord;
uniform sampler2D colorMap;
uniform sampler2D offsetMap;

void main (void)
{
vec4 pixel;

float rx=-texture2D(offsetMap, vec2(scroll,texCoord.y+scrolly)).r*amp;
float gx=-texture2D(offsetMap, vec2(scroll,texCoord.y+scrolly)).g*amp;
float bx=-texture2D(offsetMap, vec2(scroll,texCoord.y+scrolly)).b*amp;

pixel.r=texture2D(colorMap, vec2(texCoord.x+rx,texCoord.y)).r;
pixel.g=texture2D(colorMap, vec2(texCoord.x+gx,texCoord.y)).g;
pixel.b=texture2D(colorMap, vec2(texCoord.x+bx,texCoord.y)).b;

/*
if (texCoord.x+rx<0.0f) pixel=vec4(0,0,0,0);//pixel.r=0.0f;
if (texCoord.x+gx<0.0f) pixel=vec4(0,0,0,0);//0.0f;
if (texCoord.x+bx<0.0f) pixel=vec4(0,0,0,0);//0.0f;
if (texCoord.x+rx>=1.0f) pixel=vec4(0,0,0,0);//
if (texCoord.x+gx>=1.0f) pixel=vec4(0,0,0,0);//
if (texCoord.x+bx>=1.0f) pixel=vec4(0,0,0,0);//
*/

gl_FragColor = pixel;

}
