| e8555c89 Andy McCall |
1 |
// Scale2x scaler. |
| 2 |
|
| 3 |
uniform sampler2D tex; |
| 4 |
uniform sampler2D videoTex; |
| 5 |
|
| 6 |
varying vec2 texStep; // could be uniform |
| 7 |
varying vec2 coord2pi; |
| 8 |
varying vec2 texCoord; |
| 9 |
varying vec2 videoCoord; |
| 10 |
|
| 11 |
vec4 scaleNx() |
| 12 |
{ |
| 13 |
vec4 delta; |
| 14 |
delta.xw = sin(coord2pi) * texStep; |
| 15 |
delta.yz = vec2(0.0); |
| 16 |
|
| 17 |
vec4 posLeftTop = texCoord.stst - delta; |
| 18 |
vec4 posRightBot = texCoord.stst + delta; |
| 19 |
|
| 20 |
vec4 left = texture2D(tex, posLeftTop.xy); |
| 21 |
vec4 top = texture2D(tex, posLeftTop.zw); |
| 22 |
vec4 right = texture2D(tex, posRightBot.xy); |
| 23 |
vec4 bot = texture2D(tex, posRightBot.zw); |
| 24 |
|
| 25 |
if (dot(left.rgb - right.rgb, top.rgb - bot.rgb) == 0.0 || left.rgb != top.rgb) { |
| 26 |
return texture2D(tex, texCoord.st); |
| 27 |
} else { |
| 28 |
return top; |
| 29 |
} |
| 30 |
} |
| 31 |
|
| 32 |
void main() |
| 33 |
{ |
| 34 |
#if SUPERIMPOSE |
| 35 |
vec4 col = scaleNx(); |
| 36 |
vec4 vid = texture2D(videoTex, videoCoord); |
| 37 |
gl_FragColor = mix(vid, col, col.a); |
| 38 |
#else |
| 39 |
gl_FragColor = scaleNx(); |
| 40 |
#endif |
| 41 |
} |