resources/scanlines.fs
1	#version 330 core

2 out vec4 FragColor;
3
4 in vec2 TexCoords;
5
6 uniform sampler2D screenTexture;
7 uniform vec3 screenSize;
8 uniform bool screenBurn;
9
10 void main()
11 {
12 vec3 col = texture(screenTexture, TexCoords).rgb;
13 float scanLine = mod(gl_FragCoord.y, 2.0) * 0.25;
14 vec3 scanColor = col.rgb - scanLine;
15
16 if (col.r < 0.1f && col.g < 0.1f && col.b < 0.1f) {
17 if (screenBurn) {
18 float dist = (1.0 - distance(vec2(gl_FragCoord.x / screenSize.x, gl_FragCoord.y / screenSize.y), vec2(0.5,0.5))) * 0.2;
19 FragColor = vec4(0.0, dist, dist, 1.0);
20 } else {
21 FragColor = vec4(0.0, 0.0, 0.0, 1.0);
22 }
23 } else {
24 FragColor = vec4(scanColor, 1.0);
25 }
26 }