EAGLLayer.opaque 设置为 YES

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. 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值