#version 410 uniform sampler2D waveformTexture; in vec2 uvV; // 0..1 across the terminal window in float alphaV; in vec4 colorV; in float waveformYV; out vec4 fragColor; void main (void) { float waveValue = texture(waveformTexture, vec2(uvV.x, waveformYV)).r; waveValue = (waveValue + 1.0) / 2.0; // scale down -1..+1 to 0..1 fragColor = colorV; if(uvV.y < waveValue) fragColor.rgb *= 0.8; }