
uniform sampler2D colortex;
uniform sampler2D datatex;
uniform float scale;

void main(void) {
  vec3 col;
  float pier;
  
  pier = texture2D(datatex, vec2(gl_TexCoord[0].y, 0.5)).r;
  
  col.r = texture2D(colortex, vec2(gl_TexCoord[0].x+pier*scale, gl_TexCoord[0].y)).r; 
  col.g = texture2D(colortex, vec2(gl_TexCoord[0].x-pier*scale, gl_TexCoord[0].y)).g;
  col.b = texture2D(colortex, vec2(gl_TexCoord[0].x+pier*scale*0.5, gl_TexCoord[0].y)).b;
  
  gl_FragColor = vec4(col, 1.0);
}


