您的位置:首页 > 产品设计 > UI/UE

EAGLLayer.opaque 设置为 YES

2012-11-13 16:32 253 查看
By default, CALayers are set to non-opaque (i.e.
transparent). However, this is bad for performance reasons (especially with OpenGL), so it’s best to set this as opaque when possible.

Improving Compositing Performance in Core Animation

The contents of renderbuffers are animated and composited along with any other Core Animation layers inyour view hierarchy, regardless of whether those layers were drawn with OpenGL
ES, Quartz or other graphicslibraries. That’s helpful, because it means that OpenGL ES is a first-‐class citizen to Core Animation. However,mixing OpenGL ES content with other content takes time; when used improperly, your application may performtoo slowly
to reach interactive frame rates. The performance penalties for mixing and matching content varydepending on the underlying graphics hardware on the iOS device; devices that use the PowerVR MBX graphicsprocessor incur more severe penalties when compositing
complex scenes. For best results, alway test yourapplication on all iOS devices you intend it to ship on.

For the absolute best performance, your application should rely solely on OpenGL ES to render your content.To do this, size the view that holds your
CAEAGLLayer
object to match the screen, set its
opaque
propertyto
YES,
and ensure that no other Core Animation layers or views are visible. If your OpenGL ES layer is compositedon top of other layers, making your
CAEAGLLayer
object opaque reduces but doesn’t eliminate the performancecost.

If your
CAEAGLLayer
object is blended on top of layers underneath it in the layer hierarchy, the renderbuffer’scolor data must be in a premultiplied alpha format to be composited correctly by
Core Animation. BlendingOpenGL ES content on top of other content has a severe performance penalty.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: