source: trunk/tools/neercs/video/color.lolfx @ 2277

Last change on this file since 2277 was 2092, checked in by sam, 8 years ago

neercs: do not pass the texture coordinates from the application to
the GL server; instead, simply deduce them from the vertex coordinates
and interpolate them in the fragment shader.

File size: 745 bytes
Line 
1[vert.glsl]
2
3#version 120
4
5void main()
6{
7    gl_Position = gl_Vertex;
8}
9
10[frag.glsl]
11
12#version 120
13
14uniform sampler2D texture;
15uniform vec2 screen_size;
16uniform vec3 filter;
17uniform vec4 color;
18uniform float flash;
19
20void main(void)
21{
22    vec2 p = gl_FragCoord.xy / screen_size.xy;
23    vec3 c = texture2D(texture,p).xyz;
24
25    float a = (c.x + c.y + c.z) / 3.0;
26    c = mix(c, vec3(a), color.w);              // grayscale
27    c *= filter;                               // filter
28    c += color.z * 0.1;                        // level
29    c *= color.x;                              // brightness
30    c = 0.5 + (c - 0.5) * color.y;             // contrast
31    c += flash;                                // flash
32
33    gl_FragColor = vec4(c, 1.0);
34}
Note: See TracBrowser for help on using the repository browser.