From b1a90a7f915e7779aad975a70b503788b0a1b228 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Wed, 2 Sep 2015 02:44:16 +0200 Subject: Added some useful postprocessing shaders Shaders come in two flavours: - shaders/gl330: OpenGL 3.3+ (Windows, Linux, OSX) - shaders/gles100: OpenGL ES 2.0 (Android, RPI, HTML5) --- shaders/gl330/predator.fs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 shaders/gl330/predator.fs (limited to 'shaders/gl330/predator.fs') diff --git a/shaders/gl330/predator.fs b/shaders/gl330/predator.fs new file mode 100644 index 00000000..77882917 --- /dev/null +++ b/shaders/gl330/predator.fs @@ -0,0 +1,27 @@ +#version 330 + +in vec2 fragTexCoord; + +out vec4 fragColor; + +uniform sampler2D texture0; +uniform vec4 tintColor; + +// NOTE: Add here your custom variables + +void main() +{ + vec3 color = texture2D(texture0, fragTexCoord).rgb; + vec3 colors[3]; + colors[0] = vec3(0.0, 0.0, 1.0); + colors[1] = vec3(1.0, 1.0, 0.0); + colors[2] = vec3(1.0, 0.0, 0.0); + + float lum = (color.r + color.g + color.b)/3.0; + + int ix = (lum < 0.5)? 0:1; + + vec3 tc = mix(colors[ix], colors[ix + 1], (lum - float(ix)*0.5)/0.5); + + fragColor = vec4(tc, 1.0); +} \ No newline at end of file -- cgit v1.2.3