gain.frag 492 B

12345678910111213141516171819202122
  1. #extension GL_ARB_texture_rectangle : enable
  2. uniform sampler2DRect MyTex;
  3. uniform vec4 gain;
  4. void main(void)
  5. {
  6. vec2 pos = (gl_TextureMatrix[0] * gl_TexCoord[0]).st;
  7. vec4 color_old = texture2DRect(MyTex, vec2(pos.x, pos.y));
  8. vec4 color_new = color_old;
  9. color_new.r = clamp(gain.r * color_old.r, 0., 1.);
  10. color_new.g = clamp(gain.g * color_old.g, 0., 1.);
  11. color_new.b = clamp(gain.b * color_old.b, 0., 1.);
  12. color_new.a = clamp(gain.a * color_old.a, 0., 1.);
  13. gl_FragColor = color_new;
  14. }