graphics efficiency in Android: Canvas.drawBitmap or OpenGL


Last Updated:

  1. Tertium

    Tertium New Member This Topic's Starter

    Joined:
    Dec 4, 2008
    Messages:
    4
    Likes Received:
    0
    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...
     

    Advertisement
  2. Ageless Stranger

    Ageless Stranger Well-Known Member

    Joined:
    Dec 2, 2008
    Messages:
    699
    Likes Received:
    49
    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
     
  3. Tertium

    Tertium New Member This Topic's Starter

    Joined:
    Dec 4, 2008
    Messages:
    4
    Likes Received:
    0
    ok, theoretically it's so. i knew it, because games uses opengl :)

    I've asked - practically...
     
  4. cristian.vrabie

    cristian.vrabie New Member

    Joined:
    Jul 14, 2010
    Messages:
    1
    Likes Received:
    0
    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.
     

Share This Page

Loading...