I am transferring a 2D game from Windows Phone 7 (developed in XNA 4.0) to Android. I use a lot of calls to Canvas.drawBitmap () - about 200-300 to update each frame - with different colors for each call to handle different transparency and color when painting. This control of particle systems and various other overlays and in-game effects, as well as tiled backgrounds and game sprites. I do not make any changes or rotations on demand, these are simple src-> dest rectangles of the same size.
In WP7, this works at 30 + fps, but I'm struggling to get 12 frames per second on my Android hardware (Samsung Galaxy S). This makes the game unplayable. By profiling the code, I confirmed that all my time is wasted in Canvas.drawBitmap ()
I seem to follow all the usual performance recommendations - using SurfaceView, mindful of the GC, so as not to create loads of dropped objects and avoid Drawables.
I understand correctly that Canvas.drawBitmap () is processor-bound, and if I want to improve performance, do I need to switch to OpenGL, which will use the GPU? I canβt find that he stated that he was bald anywhere, but, reading between the lines of some comments, I think that perhaps this will be my next step ...?
android opengl-es xna android-canvas frame-rate
Paul Harman
source share