I notice that my GL rendering seems to fall behind by a frame or two while I'm animating. There are two modes to my event loop:
Non-animating:
1. Block on ALooper for an event
2. Drain ALooper until empty
3. Update scene
4. Draw
5. Swap
Animating: (same as non-animating, with step (1) eliminated
1. Drain ALooper until empty
2. Update scene
3. Draw
4. Swap
I have a very simple test scene (a single polygon that you can drag around with your finger). In the non-animating case, it sticks to your finger well. In the animating case, it seems to fall behind by _at least_ an extra frame as I drag the polygon around.
Two hacks appear to mitigate this: (a) glFinish after the Swap, never lets things get too far behind, (b) short usleep before the Drain [in theory this would give the system more time to present the last frame or more time to let fresh touch events queue up before I start draining them... not exactly sure which is the issue].
Has anyone experienced a similar issue (is triple buffering kicking in? possible to disable?) or are there docs on how to coordinate between a vsync'd swapbuffer call and draining the event queue to minimize latency?
Thanks,
Loren