graphics efficiency in Android: Canvas.drawBitmap or OpenGL

All your problems with Audio, Video and Images.

graphics efficiency in Android: Canvas.drawBitmap or OpenGL

Postby Tertium » Fri Dec 05, 2008 12:45 am

Hi there!
Several days ago i began to learn about Android (and java also). I have written simple graphics engine (learn from LunaLander sample api).
It's structure looks like:
1st thread - gui
2nd - thread of drawing graphics on main view (extends SurfaceView) using SurfaceHolder.lockCanvas() - SurfaceHolder.unlockCanvasAndPost().

Test: in draw circle I call canvas.drawColor(Color.WHITE).
~65fps
Then I draw one jpeg 480x320 and five 200x200 with alpha
~13fps

In other words 350Kpx - it is treshold of gaming usability?

I may be wrong, coz it's just an emulator. I have no G1, so I can't see what fps will be on target platform.

But maybe emulator shows "real" fps, and my app on G1 will run the same slow?

And 2 question:

maybe try to implement sprite draw using OpenGL? Will it be faster? Never touched it before, but if it's really faster I'll try...
Tertium
Junior Developer
Junior Developer
 
Posts: 10
Joined: Fri Dec 05, 2008 12:43 am

Top

Postby MrSnowflake » Fri Dec 05, 2008 12:50 pm

Well, you should test this on a real G1 to be sure. Make some test applications with the Canvas, one using the SurfaceView, and the same in OpenGL. Then have someone test your app(s) and have him send you the fps of the different test. Try to run each test multiple times, to even out scores and cpu usage.

This will probably be very handy for a lot of people, to finally know which way is the fastest!
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Postby Tertium » Sun Dec 07, 2008 5:52 am

Hah, i thought that somebody does it , but alas

for now i have engine based on surface-method.
I thought that opengl faster but on mobiles gl es - is for compatiblity, and native android methods must be optimized as well
Tertium
Junior Developer
Junior Developer
 
Posts: 10
Joined: Fri Dec 05, 2008 12:43 am

Postby MrSnowflake » Sun Dec 07, 2008 1:49 pm

Tertium wrote:Hah, i thought that somebody does it , but alas

for now i have engine based on surface-method.
I thought that opengl faster but on mobiles gl es - is for compatiblity, and native android methods must be optimized as well
Chances are that OpenGL will be faster, but it could also use more battery and, it could be a lot SLOWER if it's getting ran on devices without hardware OpenGL support.

Using a SurfaceView should give direct access to the buffer, so it should be fairly fast!
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 8 guests