Learning Graphics Framework for iPhone Development
I have some development experience of CocoaTouch Layer, Core Service Layer iPhone Applications.
Now, I have to migrate for some pure 2d and 3d graphical iPhone Applications.
For that as per my knowledge, I need following frameworks to learn :
1) Core Graphics 2) OpenGL ES 3) Quartz Core
I want to know that what should be the approac开发者_开发技巧h to learn this framework quickly.
Or else which framework to learn and which is not, and using which source I should learn this frameworks.
Thanks in Advance
Core Graphics
For this, I'd first recommend reading the Quartz 2D Programming Guide. It's the best set of documentation you'll find out there on the subject. Next, I'd read through some of the questions here tagged core-graphics, quartz-2d, or quartz-graphics. There are some great source code examples in the answers to those questions.
OpenGL ES
There are many "getting started with OpenGL ES" questions here, with links to many resources. These include:
- Books on OpenGL ES targeted towards the iPhone
- Learning OpenGL ES 1.x
- What do I have to learn to get done with a 3D racing game for the iPhone? What Tools do I need?
- Want to display a 3D model on the iPhone: how to get started?
I personally recommend the book "Mobile 3D Graphics: with OpenGL ES and M3G", as well as the "OpenGL ES Programming Guide for iPhone OS". My application Molecules is open source and it uses OpenGL ES. Finally, Jeff LaMarche has a great tutorial series on OpenGL ES.
Core Animation
By Quartz Core, you probably mean Core Animation. Again, I'd start with Apple's Core Animation Programming Guide, then take a look at the code examples you can find here under the various core-animation tagged questions. Beyond that, Bill Dudney's Core Animation for Mac OS X and the iPhone book is a very good introduction, and Marcus Zarra and Matt Long's Core Animation book looks to go into more detail on the subject.
I'm not sure there is a quick way really. The docs are pretty vast. And you need a pretty solid knowledge of fundamental graphics principles. I had trouble getting my head round the concepts and I have used a lot of graphics toolkits.
Couple of points that might be useful:
when trying to draw a rotated image, you need to translate the coordinate transformation back to the QUARTZ origin (bottom left) not some custom origin you set up eg top-left
SO you're best off (unless you know you and no one else maintaining your code will ever want to daw rotated images) accepting the possibly new to you ideas of using bottom left coordinates (where appropriate) rather than trying to override them by changing the context CTMs
don't assume that Core Graphics can do everything you want. You may need to manipulate pixels manually yourself for some tasks
design with the memory limitations and numbers and sizes of buffers to do a processing sequence firmly in mind
design with the texture size limitation of 1024 pixels in mind
make sure you use algorithms and approaches that are within the capabilities of the CPU and/or GPU; test with a mock-up first to sound out the performance issues
if doing 3D animations in OpenGL ES make sure that you have a way to reconcile and synchronize real time with the physics model of whatever you are animating
consider colour management, shading and highlighting, pay particular attention to the device's capabilities there
where possible use Core Animation instead of Core Graphics
精彩评论