gamma correction in post when there's no sRGB framebuffer and simple shader compositi...
[vrfileman] / sdr / post.p.glsl
1 uniform sampler2D tex;
2
3 #ifndef set_pixel
4 #define set_pixel set_pixel_linear
5 #endif
6
7 void set_pixel_linear(vec3 c)
8 {
9         gl_FragColor.rgb = c;
10         gl_FragColor.a = 1.0;
11 }
12
13 void set_pixel_srgb(vec3 c)
14 {
15         gl_FragColor.rgb = pow(c, vec3(1.0 / 2.2));
16         gl_FragColor.a = 1.0;
17 }
18
19 void main()
20 {
21         vec3 texel = texture2D(tex, gl_TexCoord[0].st).rgb;
22
23         set_pixel(texel);
24 }