summaryrefslogtreecommitdiffhomepage
path: root/shaders/gles100/scanlines.fs
diff options
context:
space:
mode:
authorraysan5 <[email protected]>2015-09-02 02:44:16 +0200
committerraysan5 <[email protected]>2015-09-02 02:44:16 +0200
commitb1a90a7f915e7779aad975a70b503788b0a1b228 (patch)
tree74cdef91c597f787ad9691436a55a7e5a6788d1d /shaders/gles100/scanlines.fs
parentda5221910fb1c6e847675a6f5d39130e50b2c12a (diff)
downloadraylib-b1a90a7f915e7779aad975a70b503788b0a1b228.tar.gz
raylib-b1a90a7f915e7779aad975a70b503788b0a1b228.zip
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)
Diffstat (limited to 'shaders/gles100/scanlines.fs')
-rw-r--r--shaders/gles100/scanlines.fs41
1 files changed, 41 insertions, 0 deletions
diff --git a/shaders/gles100/scanlines.fs b/shaders/gles100/scanlines.fs
new file mode 100644
index 00000000..56a6f694
--- /dev/null
+++ b/shaders/gles100/scanlines.fs
@@ -0,0 +1,41 @@
+#version 100
+
+precision mediump float;
+
+varying vec2 fragTexCoord;
+
+uniform sampler2D texture0;
+uniform vec4 tintColor;
+
+// NOTE: Add here your custom variables
+
+float offset = 0;
+float frequency = 720/3.0;
+
+uniform float time;
+
+void main (void)
+{
+/*
+ // Scanlines method 1
+ float tval = 0; //time
+ vec2 uv = 0.5 + (fragTexCoord - 0.5)*(0.9 + 0.01*sin(0.5*tval));
+
+ vec4 color = texture2D(texture0, fragTexCoord);
+
+ color = clamp(color*0.5 + 0.5*color*color*1.2, 0.0, 1.0);
+ color *= 0.5 + 0.5*16.0*uv.x*uv.y*(1.0 - uv.x)*(1.0 - uv.y);
+ color *= vec4(0.8, 1.0, 0.7, 1);
+ color *= 0.9 + 0.1*sin(10.0*tval + uv.y*1000.0);
+ color *= 0.97 + 0.03*sin(110.0*tval);
+
+ fragColor = color;
+*/
+ // Scanlines method 2
+ float globalPos = (fragTexCoord.y + offset) * frequency;
+ float wavePos = cos((fract(globalPos) - 0.5)*3.14);
+
+ vec4 color = texture2D(texture0, fragTexCoord);
+
+ gl_FragColor = mix(vec4(0, 0.3, 0, 0), color, wavePos);
+} \ No newline at end of file