Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I hate to be picky about this but in all the time I've been doing iOS development and throughout everything I've ever read I have never seen anything to suggest that iOS using OpenGL for all of it's drawing (simulating a 2D interface in a 3D environment like the article suggests). Drawing is done using the Quartz system and animation is handled by Core Animation (which creates "an illusion of motion").


The more you know:

UIViews are basically event-handling abstractions above CALayers, which in turn are a relatively thin abstraction above common OpenGL actions. Core Animation simply manipulates these layers in the hierarchy, of which there are three per view: model, presentation, and render. The model is the one you interact with. When you change the location of a view, it changes the model, which is then reflected in the presentation. When you animate, it tweens from the beginning state to the end state. Fun fact: when you start a new animation and start it from the current screen state, it uses the presentation layer, instead of the model layer. If you don't start the animation from the current state, this is why you might see jerking - it tweens from the model layer instead of the presentation layer.

The render layer, the last of the three, is rendered by the render server, which is hardware accelerated, and shown to you. Fun fact: CALayer's renderInContext runs on the CPU, whereas UIGetScreenImage uses the render server, which is why it's so much faster - it runs on the GPU.


The OpenGL-nature of iOS was explained to me at WWDC by the head of graphics at Apple. But you can never be sure of anything!


Interesting.


My understanding is, "drawing" (in-view composition) is largely, if not completely, software (Quartz2D). Composition between views is (can be, at least) handled by the GPU; and that may well include animation of views. I don't know how absolutely accurate it is to say that such composition 'uses OpenGL'. It may use hardware that provides OpenGL functionality, but that isn't quite the same thing (Quartz composition could talk directly to the GPU using it's native command format for instance).


No, the author is right. Quartz and Core Animation are built on top of OpenGL.


Knowing that Quartz on OS X uses OpenGL, I'd assume it also uses it on iOS.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: