summaryrefslogtreecommitdiffhomepage
path: root/shaders/glsl100/grayscale.fs
diff options
context:
space:
mode:
authorraysan5 <[email protected]>2016-04-07 11:48:09 +0200
committerraysan5 <[email protected]>2016-04-07 11:48:09 +0200
commit78b502b0bf1ee796d86837c611150ed5f8d58fd2 (patch)
treef0efc476e32c3141e7a3395f32ac971caa478649 /shaders/glsl100/grayscale.fs
parent3b67a4cfba7d3b5dca805b1d1718fd2c9db64e99 (diff)
downloadraylib-78b502b0bf1ee796d86837c611150ed5f8d58fd2.tar.gz
raylib-78b502b0bf1ee796d86837c611150ed5f8d58fd2.zip
Folders rename for consistency on shaders version
Diffstat (limited to 'shaders/glsl100/grayscale.fs')
-rw-r--r--shaders/glsl100/grayscale.fs20
1 files changed, 20 insertions, 0 deletions
diff --git a/shaders/glsl100/grayscale.fs b/shaders/glsl100/grayscale.fs
new file mode 100644
index 00000000..e55545e2
--- /dev/null
+++ b/shaders/glsl100/grayscale.fs
@@ -0,0 +1,20 @@
+#version 100
+
+precision mediump float;
+
+varying vec2 fragTexCoord;
+
+uniform sampler2D texture0;
+uniform vec4 fragTintColor;
+
+// NOTE: Add here your custom variables
+
+void main()
+{
+ vec4 base = texture2D(texture0, fragTexCoord)*fragTintColor;
+
+ // Convert to grayscale using NTSC conversion weights
+ float gray = dot(base.rgb, vec3(0.299, 0.587, 0.114));
+
+ gl_FragColor = vec4(gray, gray, gray, fragTintColor.a);
+} \ No newline at end of file