Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Differences and advantages of SurfaceView vs GLSurfaceView on Android?

I'm currently playing around with 2D graphics in android and have been using a plain old SurfaceView to draw Drawables and Bitmaps to the screen. This has been working alright, but there's a little stutter in the sprite movement, and I'm wondering the feasibility to do a real time (but not terrible fast) game with this.

I know GLSurfaceView exists which uses OpenGL, but I'm curious as to the extent to which this makes a difference. Is a plain SurfaceView hardware accelerated, or do I need to use OpenGL? What type of speed difference could I expect from switching to OpenGL, and how much altering of code would it require to switch (the game logic is all in a separate object that provides an ordered array of drawables to the SurfaceView)?

like image 749
user408424 Avatar asked Aug 02 '10 07:08

user408424


1 Answers

As far as I can tell, you have to use openGL to get HW acceleration. But don't take is for granted and wait for other answers ^^

If it really is the case, the speedup should be quite important. Any 2D application should work at at very least 20 fps (generally less polygons than 3D applications)

it would take a substantial amount of code, but 1) as a first attempt, you could try with only 1 square VBO and change the matrix each time and 2) your rendering seems already quite encapsulated so it should simplify things a lot.

like image 127
Calvin1602 Avatar answered Sep 20 '22 02:09

Calvin1602