New answers tagged game-loop
I have a similar problem with jerky frames using android GL 2.0. When traced on android studio GL profiler I saw that the glcompileshader function is called multiple times during game play. This is an expensive call but accounts for the jerkiness. What causes these multiple calls to glcompilershader? I can only guess happens because the shader is invalid ...
It sounds like you simply need to round the interpolated position to the nearest integer, instead of truncating it (as float → integer conversion normally does). A simple trick (for non-negative values) is simply to add 0.5 to the value before truncating it: g2d.drawImage(image, (int)(draw.x + 0.5f), (int)(draw.y + 0.5f), null); (I'm assuming that ...
Why does my position interpolation code result in "jumpy" motion? Make sure previousPosition_ is only being updated when there's a new physics update, not every frame But I still don't know if it's a good solution.
You should move the call of timer.start() to be before your call of gameLoop(). You should also make a call to it right after the call of timer.reset().
Top 50 recent answers are included