MindlessBarber
MindlessBarber

Reputation: 1596

android open gl really slower than canvas?

im testing the android SpriteMethodTest and on default settings canvas is getting 58fps while open gl is between 50-55fps, and the gap just gets larger with more sprites.

I was under the impression that opengl is faster than canvas so is this wrong? or is their something wrong with my phone (htc desire)?

http://code.google.com/p/apps-for-android/source/browse/trunk/SpriteMethodTest/

Upvotes: 3

Views: 2392

Answers (6)

Mihai F
Mihai F

Reputation: 161

Just ran SpriteMethodTest on a HTC Tattoo (1.6, probably no GPU) and OpenGL is really bad compared to Canvas. If for 100 sprites I get a bit over 30fps, whereas all 3 OpenGL methods are under 5 fps. Currently I'm using Canvas to draw my game but I was thinking of using OpenGL from now on so I can implement a particle system which might be pretty sprite intensive.

Now I'm confused, if I can't get performance on low end devices with OpenGL why should I use it? Is this not the case on the majority of devices? Or maybe the method used in SpriteMethodTest isn't the best (I haven't looked at the code yet) as some people are saying?

Upvotes: 0

ognian
ognian

Reputation: 11541

That would be only possible on emulator or device without GPU

Upvotes: 0

ryanm
ryanm

Reputation: 3009

It should be noted that SpriteMethodTest is not using OpenGL at maximum efficiency. Each sprite is being rendered with its own set of GL calls, where ideally many sprites should be batched into as few calls to OpenGL as possible.

THere's a sprite-rendering performance shootout happening over at JavaGaming.org right now, and libGDX is the current frontrunner. When handled correctly, OpenGL is the fastest way to draw stuff.

Upvotes: 7

hackbod
hackbod

Reputation: 91321

You should probably first profile your code to make sure it is actually rendering where you are taking your time.

Upvotes: 1

Wroclai
Wroclai

Reputation: 26925

Probably you're not measuring it correct. How many sprites are you using? The FPS will probably be the same with < 10 sprites but as soon you're start increasing the number of sprites the OpenGL system will definitely beat the Canvas system.

For further information about this topic, see this.

Upvotes: 1

TurqMage
TurqMage

Reputation: 3321

I...can't...comment...

That is interesting I had always though OpenGL was faster as well. From my experience with my app I found GL to be much faster than the canvas but I was using all fixed point numbers.

Upvotes: 0

Related Questions