Untitled

Anonymous
plain_text
02/18/2026 5:00 PM
1.3 KB
10
Indexable
// green_phosphor.glsl
// Simple monochrome green phosphor shader
// For DOSBox-X OpenGL output

#ifdef GL_ES
precision mediump float;
#endif

varying vec2 TexCoord;
uniform sampler2D Texture;

void main()
{
    // sample the original pixel
    vec4 col = texture2D(Texture, TexCoord);

    // compute luminance (grayscale brightness)
    float lum = dot(col.rgb, vec3(0.299, 0.587, 0.114));

    // green phosphor tint: map luminance only to green channel
    vec3 greenCol = vec3(0.0, lum, 0.0);

    // simple scanlines: darken alternate horizontal lines
    float scan = step(0.5, fract(TexCoord.y * 720.0 * 0.5));  
    // too high resolution? adjust 720.0 to match your window height

    // subtle phosphor bloom/glow
    float glow = smoothstep(0.0, 0.2, lum);

    // combine green with scanline and glow
    vec3 finalColor = greenCol * (0.8 + 0.2 * scan) + glow * 0.05;

    gl_FragColor = vec4(finalColor, 1.0);
}
Editor is loading...
Leave a Comment