Do you have to use OpenGL for decent 2D on Android?

Started by
3 comments, last by bonus uk 12 years ago
Working on a game, and i've got all the menus and sound system going, now I have to implement the 2d gameplay. It's not very intense 2D, it's a full screen tiled board with a few small sprite animations, no 3D or exotic 2D techniques needed. Most android tutorials I see use opengl, which seems like it might be a bit overkill for this type of 2D, but then again I don't want any weird tearing or skipping going on if I use regular system drawing calls. I'd probably prefer system calls since it's less setup, but i'll go with whatever works.
Advertisement
Drawing onto a View is probably good for a sprite-based game with slower updates; it may take a while for the onDraw/invalidate cycle since invalidates can pile up to prevent issues, but it will get there eventually and it is probably going to be easier to develop.

Drawing onto the Canvas directly will have pretty good performance; just like the 3D performance the actual quality will vary by device.
Thanks for the help. What about a SurfaceView, I see some tutorials using that, i'm not sure how different that is from a plain old View(?). Is a canvas better than either for the following case: This game will be about the same graphically as a game like Tetris/Bejewelled/Zuma/etc with around the same amount of animation, no scrolling backgrounds, just one big static background with some small/med sprites moving around on top.

Thanks for the help. What about a SurfaceView, I see some tutorials using that, i'm not sure how different that is from a plain old View(?). Is a canvas better than either for the following case: This game will be about the same graphically as a game like Tetris/Bejewelled/Zuma/etc with around the same amount of animation, no scrolling backgrounds, just one big static background with some small/med sprites moving around on top.

You should be fine with any of method. That is low enough refresh rate that it really doesn't matter.

If it were a faster game that needed 15+FPS you would need something with a little more performance. As described, pretty much any rendering system can give acceptable results.
I know this post is over a month old but it asks a pertinent question regarding the performance of different 2D rendering methods.

The best discussion of this on Android I've come across is Chris Pruett's 2010 Google IO talk.

You can watch it here:



It's well worth the entire hour of your time if you're new to Android game development.

This topic is closed to new replies.

Advertisement