stereoplay
diff sdr/colorcode.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/colorcode.glsl Sun Mar 06 20:31:18 2011 +0200 1.3 @@ -0,0 +1,19 @@ 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 + vec3 col, coeff = vec3(0.15, 0.15, 0.7); 1.17 + col.r = left.r; 1.18 + col.g = left.g; 1.19 + col.b = dot(right, coeff); 1.20 + 1.21 + gl_FragColor = vec4(col, 1.0); 1.22 +}