
uniform sampler2D textures[2];
uniform int need_swap;

varying mediump vec2 texcoord;
varying mediump float scanline_out;

void main()
{
	mediump vec4 color = texture2D(textures[0], texcoord);
	color = mix(
		color * color,
		color,
		sin(scanline_out) * 0.5 + 0.5
	);
	color = vec4(pow(color.rgb, vec3(2.2/3.0)) * 2.0, 1.0);

	if (need_swap != 0) {
		gl_FragColor = color.bgra;
	} else {
		gl_FragColor = color;
	}
}
