A layer that supports drawing OpenGL content in iOS and tvOS applications.
- iOS 2.0–12.0Deprecated
- tvOS 9.0–12.0Deprecated
- Core Animation
If you plan to use OpenGL for your rendering, use this class as the backing layer for your views by returning it from your view’s
layer class method. The returned
CAEAGLLayer object is a wrapper for a Core Animation surface that is fully compatible with OpenGL ES function calls.
Prior to designating the layer’s associated view as the render target for a graphics context, you can change the rendering attributes you want using the
drawable property. This property lets you configure the color format for the rendering surface and whether the surface retains its contents.
Because an OpenGL ES rendering surface is presented to the user using Core Animation, any effects and animations you apply to the layer affect the 3D content you render. However, for best performance, do the following:
Set the layer’s opaque attribute to
Set the layer bounds to match the dimensions of the display.
Make sure the layer is not transformed.
Avoid drawing other layers on top of the
CAEAGLLayerobject. If you must draw other, non OpenGL content, you might find the performance cost acceptable if you place transparent 2D content on top of the GL content and also make sure that the OpenGL content is opaque and not transformed.
When drawing landscape content on a portrait display, you should rotate the content yourself rather than using the
CAEAGLLayertransform to rotate it.