开发者

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-a开发者_开发百科ndroid/source/browse/trunk/SpriteMethodTest/


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.


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.


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


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.


That would be only possible on emulator or device without GPU


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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜