# OpenGL ES wrong orientation

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?

• OpenGL's co-ordinate convention is that bottom-left is the origin; this matches e.g. a mathematical graph but not screen co-ordinate conventions. – Maximus Minimus May 17 '17 at 15:30
• My current set up has the view matrix on the positive z axis looking a the origin with Y as "up". and the ortho matrix is [-2,2]x[-2,2], so as I understand it the point (1.5, 1.5) should appear in the top right part of the screen... – Pixel May 17 '17 at 15:44