Reputation: 17380
in Opengl ES 2.0, is there a simple way to change the bottom left origin to be instead the Top Left when drawing? Thanks
Upvotes: 1
Views: 473
Reputation: 2022
You could use simple vertex shader, adding some logic to make tex top-right corner to be in proper position.
attribute vec4 position;
varying vec2 texCoord;
void main()
{
texCoord = position.xy * vec2(1.0, -1.0);
gl_Position = position;
}
and pixel shader just taking those texCoord and passing to sampler.
varying vec2 texCoord;
uniform sampler2D sampler;
void main(void)
{
gl_FragColor = texture2D(sampler, texCoord);
}
Upvotes: 2
Reputation: 162327
For regular drawing operations by applying an appropriate projection matrix, or flipping the Y coordinate in the vertex shader. You didn't specify what projection you use and didn't post code, so that's the answer I can give you.
Upvotes: 1