
uniform sampler2D tex1;
uniform sampler2D tex2;
uniform float scale;
uniform float bri1, bri2;

void main(void) {
  vec3 t1, t2;
  float r, g, b;
  float or, og, ob;
  
  t1 = texture2D(tex1, gl_TexCoord[0].xy).rgb*bri1;
  t2 = texture2D(tex2, gl_TexCoord[0].xy).rgb*bri2;
 
  r = max(t1.r, t2.r)+t2.r;
  g = max(t1.g, t2.g)+t2.g;
  b = max(t1.b, t2.b)+t2.b;
  or=clamp(r-1.0, 0.0, 1.0);
  og=clamp(g-1.0, 0.0, 1.0);
  ob=clamp(b-1.0, 0.0, 1.0);

  gl_FragColor = vec4(r+og, g+ob, b+or, 1.0);
}


