I'm writing a little Android game in OpenGL ES. My game graphics are not appearing in the right orientation. In fact everything is drawn in reverse vertically. Can someone please comment on my understanding of how OpenGL works below please?
My understanding is that OpenGL works in a right handed coordinate system, e.g.
y(+) | | o-----x(+) / / z(+)
So, I set my orthographic projection matrix using
Matrix.orthoM(..., -2, 2, -2, 2, 1, 15)
for example, so if I were to draw a line from (-2, 2, 0) to (2, -2, 0) I should be drawing a line in the X/Y plane from (-2, 2) top (2, -2). Near and far planes are 1 and 15 respectively.
In addition I am setting up my view matrix using
Matrix.setLookAtM(mViewMatrix, 0, 0, 0, 10, 0, 0, 0, 0, 1, 0)
so I'm standing on the positive Z axis at 10 units, looking towards the origin with the Y axis as the upwards vector.
But when I come to draw stuff, everything is flipped in the X axis. So a point at (1, 1) would appear at (1, -1).
Does anyone see what might be wrong here?