chewbapoclypse - 1 year ago 106

Java Question

Ok so I found this thread, which is what I believe I need to do. However, I am not using

`GL10`

`GLES20`

`glOrthof`

`GLES20`

What I want to do is

This is the normal system.

`private final String vertexShaderCode =`

"uniform mat4 uMVPMatrix;" +

"attribute vec4 aPosition;" +

"attribute vec2 aTexCoordinate;" +

"varying vec2 vTexCoordinate;" +

"void main() {" +

" gl_Position = uMVPMatrix * aPosition;" +

" vTexCoordinate = aTexCoordinate;" +

"}";

Answer Source

The `Ortho`

is still a way to go but you need to use a matrix. So in your shader you would use a matrix as a uniform which then multiplies the input position.

In general there is no way at all you can change the coordinate system. The openGL works with normalized coordinates so no matter what you do you will always have a 0 in the center of the buffer and borders are [-1, 1] from left to right and bottom to top and the same goes for depth when using depth buffer.

So what the orthographical matrix does is scale your input coordinates to the openGL internal coordinate system and this is the procedure that even ES1 does but the difference is that the matrices are already generated for you and all the coordinates are multiplied for you in the fixed pipeline.