CAEAGLLayer Class Reference
Available in iOS 2.0 and later.
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:
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.
Accessing the Layer Properties
The properties of the native windowing surface.
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.
© 2008 Apple Inc. All Rights Reserved. (Last updated: 2008-05-19)