]> git.sesse.net Git - movit/blob - flat_input.frag
Merge branch 'master' into epoxy
[movit] / flat_input.frag
1 uniform sampler2D PREFIX(tex);
2
3 vec4 FUNCNAME(vec2 tc) {
4         // OpenGL's origin is bottom-left, but most graphics software assumes
5         // a top-left origin. Thus, for inputs that come from the user,
6         // we flip the y coordinate.
7         tc.y = 1.0 - tc.y;
8
9         vec4 pixel = tex2D(PREFIX(tex), tc);
10
11         // These two are #defined to 0 or 1 in flat_input.cpp.
12 #if FIXUP_SWAP_RB
13         pixel.rb = pixel.br;
14 #endif
15 #if FIXUP_RED_TO_GRAYSCALE
16         pixel.gb = pixel.rr;
17 #endif
18         return pixel;
19 }
20
21 #undef FIXUP_SWAP_RB
22 #undef FIXUP_RED_TO_GRAYSCALE