Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm working on a game which can't run at Full speed on some devices. On Tegra2, with many optimizations, performance is near 40 fps. The framerate is stable but animations aren't smooth enough, so i need a vsync.
With 2.3 Android SDK, we can use EGL library natively. So i try to use eglSwapInterval but no success. In this GDC Paper, it seems that Tegra2 can do it.

Ps: Thread.sleep() to force a constant FPS is not an acceptable solution

share|improve this question
I haven't developed anything for Android, so I can't say for certain if it's possible or not to affect its swap interval, though it seems doubtful. So if animation stuttering comes from a large difference in it's logic timesteps, maybe it's worth a try to calculate an average timestep for a batch of frames? Like this, maybe using a period of 5-6 frames. It's not an answer to your vsync question, but maybe it will help your animations without introducing a fixed render timestep. –  Vigil Sep 6 '11 at 20:15
As Tegra2 is an immediate renderer (not a tile), i can check if time elapsed before eglSwapBuffer is < 1/60s. If not, i wait 1ms more than the 16ms and do the eglSwapBuffer. That's just horrible!!! It is very strange that they speak about this function at the Google IO 2011 if it it not implemented. –  Ellis Sep 6 '11 at 20:30
add comment

1 Answer

According to this thread on some opengl es benchmark, most devices' drivers simply ignore the eglSwapInterval, but tegra2 should have vsync enabled by default (and eglSwapInterval can be used to disable it).

Perhaps the vsync rate on your device is such that your stuttering comes from sometimes hitting, sometimes missing the frame time? Have you tried if disabling vsync will actually improve matters?

share|improve this answer
I haven't tried to disable vsync. I tried eglSwapInterval(...,2) without success. I will try as soon as possible. –  Ellis Sep 5 '11 at 8:02
The swapinterval parameter defines the minimum amount of frames that must go by, so it's possible you're seeing stutter like 2,2,3,2,2,3,2,2,2,3 .. assuming the whole thing works, which doesn't seem to be guaranteed =) –  Jari Komppa Sep 6 '11 at 7:19
Here's another little nugget: "interval is silently clamped to minimum and maximum implementation dependent values before being stored; these values are defined by EGLConfig attributes EGL_MIN_SWAP_INTERVAL and EGL_MAX_SWAP_INTERVAL respectively." –  Jari Komppa Sep 6 '11 at 7:24
eglSwapInterval( ,2) doesn't change my framerate of 42fps and EGL_MIN_SWAP_INTERVAL is 0 and MAX 10. –  Ellis Sep 6 '11 at 7:33
Only other thing I can think of to try is go through the values 0 to 10 and see if there's any change. If there isn't, well, the function is broken. (Or well, values 0,1,9 and 10) –  Jari Komppa Sep 6 '11 at 10:36
show 4 more comments

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.