What should I learn: Quartz or OpenGL ES? [closed]

回眸只為那壹抹淺笑 提交于 2019-12-01 02:12:20

问题


I'm learning to program for the iPhone. I'm trying to figure out how to do some really cool custom view animations. What should I learn, Quartz or OpenGL ES?

For whoever says OpenGL ES, could I use it to animate my views or is only Quartz suitable for the task? Thanks.

Also any resources / the book or anything that teaches you this stuff in the most painless manner?


回答1:


By Quartz, you probably mean Core Animation. Quartz is simply the Mac / iPhone 2-D drawing API, where Core Animation handles animation of views and layers.

It is very difficult to use OpenGL for performing custom animations on views, but Core Animation is designed for this purpose. It has been my recommendation to people that if they are thinking about doing 2-D animations, even in games, they should look at Core Animation first and go to OpenGL ES only if Core Animation's performance is unacceptable. Core Animation lets you do a lot with just a little code, and there are now plenty of great references out there on the topic (such as Marcus Zarra and Matt Long's new book).

You may wish to refer to some of these other questions for more:

  • iPhone board game: OpenGL ES or CoreGraphics?
  • Core Animation or OpenGL for simple iPhone game
  • Quartz 2D vs OpenGL ES Learning Curve



回答2:


You can actually animate views without even going into Quartz. There's a lot you can do with UIKit. Apple's documentation recommends:

In general, you should use the highest-level framework that meets the requirements of your application. Use lower-level frameworks only when you need more precise control or more powerful capabilities.




回答3:


If you want to animate your views, start with Core Animation. It can do a lot for you already. If after trying you can't get the effect you want with CoreAnimation alone, then use it in conjunction with Quartz. If that still can't suit your exact need, then only investigate OpenGL.




回答4:


If you want to animate the movement of views around the screen then core animation is what you want.

If you want to run a custom animation inside a view then you should use OpenGLES for the best performance.

You can do both at once.



来源:https://stackoverflow.com/questions/2328487/what-should-i-learn-quartz-or-opengl-es

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