#version 330 // TODO: for now this is just a scanline shader for testing // Input vertex attributes (from vertex shader) in vec2 fragTexCoord; in vec4 fragColor; // Input uniform values uniform sampler2D texture0; uniform vec4 colDiffuse; // Output fragment color out vec4 finalColor; // NOTE: Add here your custom variables // NOTE: Render size values must be passed from code const float renderWidth = 800; const float renderHeight = 450; float offset = 0.0; uniform float time; void main() { float frequency = renderHeight/3.0; // Scanlines method 2 float globalPos = (fragTexCoord.y + offset) * frequency; float wavePos = cos((fract(globalPos) - 0.5)*3.14); // Texel color fetching from texture sampler vec4 texelColor = texture(texture0, fragTexCoord); finalColor = mix(vec4(0.0, 0.3, 0.0, 0.0), texelColor, wavePos); }