stereoplay

diff sdr/redblue.glsl @ 0:265a24704ff2

stereoplay
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 06 Mar 2011 20:31:18 +0200
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/sdr/redblue.glsl	Sun Mar 06 20:31:18 2011 +0200
     1.3 @@ -0,0 +1,21 @@
     1.4 +uniform sampler2D tex;
     1.5 +uniform float left_offs, right_offs;
     1.6 +
     1.7 +void main()
     1.8 +{
     1.9 +	vec2 tc_half = gl_TexCoord[0].st * vec2(0.5, 1.0);
    1.10 +	vec2 tc_left = tc_half + vec2(left_offs, 0.0);
    1.11 +	vec2 tc_right = tc_half + vec2(right_offs, 0.0);
    1.12 +	
    1.13 +	vec3 left = texture2D(tex, tc_left).rgb;
    1.14 +	vec3 right = texture2D(tex, tc_right).rgb;
    1.15 +
    1.16 +
    1.17 +
    1.18 +	vec3 col;
    1.19 +	col.r = (left.r + left.g + left.b) / 3.0;
    1.20 +	col.g = 0.0;
    1.21 +	col.b = (right.r + right.g + right.b) / 3.0;
    1.22 +
    1.23 +	gl_FragColor = vec4(col, 1.0);
    1.24 +}