CAEAGLLayer Class Reference

Inherits from
Conforms to
Available in iOS 2.0 and later.
Declared in
Related sample code


The CAEAGLLayer class supports drawing OpenGL content in iPhone applications. 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 layerClass 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 drawableProperties 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:


Accessing the Layer Properties



The properties of the native windowing surface.

@property(copy) NSDictionary *drawableProperties

You can use this property to change the underlying color format for the windowing surface and whether or not the surface retains its contents. For a list of keys (and corresponding values) you can include in this dictionary (along with their default values), see the EAGLDrawable Protocol Reference.