summaryrefslogtreecommitdiffhomepage
path: root/shaders/glsl330/scanlines.fs
diff options
context:
space:
mode:
authorraysan5 <[email protected]>2016-05-18 12:04:27 +0200
committerraysan5 <[email protected]>2016-05-18 12:04:27 +0200
commitbc08271da3e68d2880f4ef712c13e88b99f1021d (patch)
treea2b3fb728de4984a12b97728491205613e3c951b /shaders/glsl330/scanlines.fs
parent0e29aa2951fe11e9d0fabec2182ed6309fce37bb (diff)
downloadraylib-bc08271da3e68d2880f4ef712c13e88b99f1021d.tar.gz
raylib-bc08271da3e68d2880f4ef712c13e88b99f1021d.zip
Updated shaders with comments
Diffstat (limited to 'shaders/glsl330/scanlines.fs')
-rw-r--r--shaders/glsl330/scanlines.fs15
1 files changed, 10 insertions, 5 deletions
diff --git a/shaders/glsl330/scanlines.fs b/shaders/glsl330/scanlines.fs
index 0c89e610..177f000d 100644
--- a/shaders/glsl330/scanlines.fs
+++ b/shaders/glsl330/scanlines.fs
@@ -1,12 +1,16 @@
#version 330
+// Input vertex attributes (from vertex shader)
in vec2 fragTexCoord;
+in vec4 fragColor;
-out vec4 fragColor;
-
+// Input uniform values
uniform sampler2D texture0;
uniform vec4 fragTintColor;
+// Output fragment color
+out vec4 finalColor;
+
// NOTE: Add here your custom variables
float offset = 0.0;
@@ -14,7 +18,7 @@ float frequency = 720.0/3.0;
uniform float time;
-void main (void)
+void main()
{
/*
// Scanlines method 1
@@ -35,7 +39,8 @@ void main (void)
float globalPos = (fragTexCoord.y + offset) * frequency;
float wavePos = cos((fract(globalPos) - 0.5)*3.14);
- vec4 color = texture(texture0, fragTexCoord);
+ // Texel color fetching from texture sampler
+ vec4 texelColor = texture(texture0, fragTexCoord);
- fragColor = mix(vec4(0.0, 0.3, 0.0, 0.0), color, wavePos);
+ finalColor = mix(vec4(0.0, 0.3, 0.0, 0.0), texelColor, wavePos);
} \ No newline at end of file