blob: eb3f902f93b54a29f32b327521218a5f3a03b5ef (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
// license:BSD-3-Clause
// copyright-holders:Sven Gothel
#pragma optimize (on)
#pragma debug (off)
uniform sampler2D color_texture;
uniform vec4 vid_attributes; // gamma, contrast, brightness
// #define DO_GAMMA 1 // 'pow' is very slow on old hardware, i.e. pre R600 and 'slow' in general
void main()
{
#ifdef DO_GAMMA
vec4 gamma = vec4( 1.0 / vid_attributes.r, 1.0 / vid_attributes.r, 1.0 / vid_attributes.r, 0.0);
// gamma, contrast, brightness equation from: rendutil.h / apply_brightness_contrast_gamma_fp
vec4 color = pow( texture2D(color_texture, gl_TexCoord[0].st) , gamma);
#else
vec4 color = texture2D(color_texture, gl_TexCoord[0].st);
#endif
// contrast/brightness
gl_FragColor = (color * vid_attributes.g) + vid_attributes.b - 1.0;
}
|