qzdoom-gpl/wadsrc/static/shaders/glsl/present.fp

22 lines
404 B
Text
Raw Normal View History

in vec2 TexCoord;
out vec4 FragColor;
uniform sampler2D InputTexture;
uniform float InvGamma;
uniform float Contrast;
uniform float Brightness;
vec4 ApplyGamma(vec4 c)
{
vec3 val = c.rgb * Contrast - (Contrast - 1.0) * 0.5;
val += Brightness * 0.5;
val = pow(max(val, vec3(0.0)), vec3(InvGamma));
return vec4(val, c.a);
}
void main()
{
FragColor = ApplyGamma(texture(InputTexture, TexCoord));
}