How to correctly map screen to opengl coordinate? lazarus / 43-Android ---------------------------------------------------------------------- Leledumbo · 2013-08-06 00:02 Attached is the modified hello-gl2 example project with touch event, so that when you touch the screen a red square should be drawn. However, currently it's not drawn at the right point. I think it's due to wrong mapping formula from screen (which is retrieved from onTouchEvent) to opengl. Anyone know how to fix? ---------------------------------------------------------------------- User137 · 2013-08-06 07:26 Can't you determine the right formula, based on where you see it, and where it should be? In OpenGL ES you can't use gluOrtho2D() and you aren't using even the basic projection-modelview-matrix model. I don't even know how the maths are mapping without them. Could be 0..1 to 0..Width, or 0..Width directly. In normal OpenGL the Y-axis is flipped, so that 0, 0 is bottom-left of the screen, not top-left we have used to seeing in graphics. Some tutorial was here http://www.learnopengles.com/understanding- opengls-matrices/ edit: It starts by saying QuoteThe first problem is that they always range from -1 to +1 ---------------------------------------------------------------------- Leledumbo · 2013-08-06 07:58 QuoteThe first problem is that they always range from -1 to +1This might be a good hint. I was thinking the range comes from 0 to 1, which might be the cause of miscalculation. I already know the y axis is flipped, which is why I subtract the current y (on touch) from 1. I'm still using whatever OpenGL provides by default because I'm still learning and I don't want to mess with projection yet.