Given the next vertex shader, what is the simplest, most efficient and fastest way to flip the coordinates upside down, so the fragment shader will produce and upside down image?
attribute vec4 a_position;
attribute vec2 a_texcoord;
varying vec2 v_texcoord;
void main()
{
v_texcoord = a_texcoord.st;
gl_Position = a_position;
}
Just flip v_texcoord
. So e.g.
v_texcoord = a_texcoord.st * vec2(1.0, -1.0);
Or, I guess:
v_texcoord = vec2(a_texcoord.s, 1.0 - a_texcoord.t);
Depending on what exactly you want to happen to the range of .t
.