Does openGL ES have a better performance than Core Animation and UIKit when it comes to highly animated user interfaces?

后端 未结 3 798
时光说笑
时光说笑 2021-02-06 08:53

Currently I have an user interface that makes incredible heavy use of core animation. I wonder if it is worth to spent another 2 months for learning openGL ES? Does that really

3条回答
  •  日久生厌
    2021-02-06 09:35

    In theory OpenGL should be the fastest API on the device, simply because it’s closest to hardware. (Somebody please correct me if I am wrong on this.) In OpenGL you can do some clever tricks that will help your performance quite a bit – you can draw the sprites in batches, you can use point sprites, you can try compressing the textures, etc.

    On the other hand you get very close to the hardware and there is not much abstraction left, at least when comparing to Core Animation. You have to deal with non-power-of-two textures, projections, matrices, you have to write the animation code yourself, etc. There is a lot of places you can go wrong and seriously kill the performance instead of making it better.

    What I like about OpenGL is that it’s cross-platform. There are lots of resources about OpenGL, there is a lot of space for improvement. If you want to write games and have the time to learn OpenGL, do it. Wrapping the OpenGL basics into an OOP design is not that hard and eventually you’ll get more space for performance improvements. A good place to start is the Cocos 2D engine for iPhone.


    (Disclaimer: I know just a little bit about OpenGL and nothing much about Core Animation. I’ve written two 2D games for iPhone using OpenGL.)

提交回复
热议问题