On Sun, Oct 2, 2011 at 9:41 PM, Beck Olson <[email protected]> wrote: > > Our images are 42x1344 and we are drawing about 12 sprites at a time. > The best frame rate we have been able to achieve is about 25 frames > per second (on a samsung galaxy). > > So my question is what is the proper way to draw 2D sprites? Should we > split up each frame into its own image? Should we use Drawable objects > instead? Do we need to use OpenGL?
Chris Pruett, the author of Replica Island, ran some tests earlier which you can google (I don't have the link handy but I think he mentioned the tests on his Replica Island blog( http://replicaisland.blogspot.com/)). His conclusion IIRC was, if you draw more than a couple of sprites a frame you will probably need OpenGL. My own experience seems to support this so far. I also found out that even if you do draw just a few sprites a frame a nice little caveat is that you will likely want to make sure you use dirty rectangles for moving stuff because just clearing the screen (which was blitting a background image in my case) took an inordinate amounts of time drawing through Canvas, at least on devices like HTC Desire or Samsung Galaxy S with fairly high-resolution screens. When you say "we are drawing about 12 sprites at a time", I don't know whether to read it as "12 sprites per frame", and the decision obviously depends on the total area of all sprites you draw per frame and a whole lot of other factors - but it sounds to me like you would probably do well to look into going down the GL route unless you have a good reason not to. YMMV though. ;-) -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

