• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps graphics efficiency in Android: Canvas.drawBitmap or OpenGL

Tertium

Lurker
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...
 
I have always found openGL rendering to out-perform bit blitting, but I havent tried a comparison on the phone yet. traditionally openGL has access to device hardware, whilst bit blitting uses generic OS calls which tend to be slower
 
As a side-note here: don't do fps testing on the emulator. I discovered in many occasions that the emulator behaves in strange ways. The most extreme case was that in an OpenGL application: after doing some heavy optimizations, the fps was double on all the devices I tested. However in the emulator the fps rate was worse.
 
Back
Top Bottom