Consitant Framerate

I’ve been tooling around with this little framework. Originally I was using default 2D mode but since performance was a bit shakey for real time stuff I swapped over to using a GLSurfaceView (though still using Canvas to render to the GL).

However, I’m having a lot of trouble getting a consistent 30fps out of even rendering something very simple. It’s fine when there’s no input going on, but when I hold a key down (to rotate a wire - see my JGO compo entry) it can half the framerate - or rather it drops and then fluctuates all over the place.

I’ve done a fair bit of debugging and even if I take out the rendering/logic on the key press it seems to be basically the same problem.

Does anyone have any tips for getting a nice smooth FPS out of Android?

Kev

If you mean press the screen when you say “hold down a key”, then you need to put a sleep call (or something similar) in the onTouchEvent event, as when you’re pressing the screen, the EDT will fire onTouchEvent events as fast as it can and will chew up all the CPU.

Ah, of course, that makes sense.

Many thanks!

Kev