
uniform sampler2D texture;
uniform int need_swap;

varying mediump vec2 Frag_UV;
varying mediump vec4 Frag_Color;

void main()
{
	mediump vec2 modifiedCoord0 = vec2(Frag_UV.x, (floor(Frag_UV.y * 512.0 + 0.25) + 0.5)/512.0);
	mediump vec2 modifiedCoord1 = vec2(Frag_UV.x, (floor(Frag_UV.y * 512.0 - 0.25) + 0.5)/512.0);
	mediump vec4 color = vec4(mix(
		texture2D(texture, modifiedCoord1),
		texture2D(texture, modifiedCoord0),
		(sin(Frag_UV.y * 1024.0 * 3.14159265359) + 1.0) * 0.5
	).rgb, 1.0);
	if (need_swap != 0) {
		gl_FragColor = color.bgra;
	} else {
		gl_FragColor = color;
	}
}
