I have a problem with implementing touch events on GLSurfaceView. Views size is 1280×696, because of android (tablet) status bar at bottom with soft keys, time etc.., (screen resolution is 1280×800), but OnTouchListener is receiving touch events with coords [646.0,739.0], and thus my gluunproject method fails to return correct values
is there any way to return events that respect these boundaries? or how should I recalculate the position?
I have a problem with implementing touch events on GLSurfaceView . Views size is
Share
In general to transition between such coordinate systems: If you transition from system A to B and you have points
where AOrigin and BOrigin represent the same location in view and same goes for AEnd and BEnd
then for point P in the receiver view:
For your case (I’m not sure because of lack of information) AOrigin is at (0,0), AEnd is at (646, 739), BOrigin is at (0,0) and BEnd is at (1280, 800):
You can also use this to transition to/from “GL” coordinates. A common case is having a view with upper left corner at (0, 0) and lower bottom at (1280, 800) and your “GL” coordinates are from (-1, 1) to (1, -1):
Also note that you may use any 2 pairs of points that represent same location on screen as long as
(origin-end).x != 0AND(origin-end).y != 0