android open gl really slower than canvas?

China☆狼群 提交于 2020-01-01 06:52:05

问题


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/


回答1:


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.




回答2:


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.




回答3:


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




回答4:


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.




回答5:


That would be only possible on emulator or device without GPU




回答6:


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?



来源:https://stackoverflow.com/questions/5355036/android-open-gl-really-slower-than-canvas

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!