I have a very simple app that render a square with opengl, input touch are read by the GLSurfaceView and last position is exchanged with the rendering thread using a volatile variable.
What I observe (and as been also very well described in https://www.mail-archive.com/android-developers@googlegroups.com/msg235325.html) is that there is a delay (a lag) between the touch position and the display.
When activating the developer option to show touch position, I see that when moving rapidly:
the circle tracking the touch position shown by the system is 1 cm delayed compared to my finger position. I assume that this is system / hardware dependent and cannot be corrected by application.
but the movement rendered in my application is delayed also 1 cm after the debug circle. So in practice the delay is twice what it could be.
When the finger movement slow down, the final position of the drawing stops and current touch position is synchronized. Exactly as shown in this video (link found on discussion above) http://www.youtube.com/watch?v=fWZGshsXDhM
Still I am clueless on what is causing the second delay, I have timed the exchange of the position from the onTouchEvent to the rendering thread and it is only a few ms. Rendering happens with a frequency of 18ms.
I have try to use velocity to shorten the appearance of the delay by predicting the position 18ms latter but it didn't change any delay perception.
Has someone an explanation for this kind of delay ? Is it caused by system layers before geting access to in it in onTouchEvent ? In which case I would see no way to correct it.
There was no specific answer on the google group. Also what bother me is that in the thread it is mentionned that the delay disappear by using a canva instead of OpenGL. Which raise more question that it answers.