dbf-udg

diff sdr/dither.p.glsl @ 11:5f99c4c7a9fe

now it looks pretty much ok
author John Tsiombikas <nuclear@member.fsf.org>
date Wed, 20 Feb 2013 04:55:03 +0200
parents 403ec1be3a1a
children 1abbed71e9c9
line diff
     1.1 --- a/sdr/dither.p.glsl	Tue Feb 19 23:46:44 2013 +0200
     1.2 +++ b/sdr/dither.p.glsl	Wed Feb 20 04:55:03 2013 +0200
     1.3 @@ -1,11 +1,23 @@
     1.4  uniform sampler2D framebuf, dither_tex;
     1.5  uniform int dither_levels, dither_size;
     1.6  
     1.7 +uniform float tfadein;
     1.8 +
     1.9 +vec4 fetch_pixel(vec2 texcoord)
    1.10 +{
    1.11 +	float x = step(0.5, mod(texcoord.y, 0.5) / 0.5);
    1.12 +	float offs = mix(1.0 - tfadein, tfadein - 1.0, x);
    1.13 +	vec2 tc = texcoord + vec2(offs, 0.0);
    1.14 +
    1.15 +	return (1.0 - step(1.0, tc.x)) * step(0.0, tc.x) * texture2D(framebuf, tc);
    1.16 +}
    1.17 +
    1.18  void main()
    1.19  {
    1.20  	float levels = float(dither_levels);
    1.21  
    1.22 -	vec4 pixel = texture2D(framebuf, gl_TexCoord[0].xy);
    1.23 +	//vec4 pixel = texture2D(framebuf, gl_TexCoord[0].xy);
    1.24 +	vec4 pixel = fetch_pixel(gl_TexCoord[0].xy);
    1.25  	float lum = dot(pixel.xyz, vec3(0.2126, 0.7152, 0.0722));
    1.26  	float coord_shift = floor(lum * levels) / levels;
    1.27