EAGLDrawable Protocol Reference

Adopted by
Framework
/System/Library/Frameworks/OpenGLES.framework
Availability
Available in iOS 2.0 and later.
Companion guide
Declared in
EAGLDrawable.h

Overview

iOS objects that implement the EAGLDrawable protocol can be used as a rendering surface and displayed to the screen by an EAGLContext object. In iOS 2.0, this protocol is implemented only by the CAEAGLLayer class, but in the future other classes may choose to implement the protocol. The EAGLDrawable protocol is not intended to be implemented by objects outside of the iOS.

Tasks

Drawable Properties

Properties

drawableProperties

A dictionary of values that specify the desired characteristics of the drawable surface. (required)

@property(copy) NSDictionary* drawableProperties;
Discussion

The drawableProperties dictionary specifies the properties that are used by this object when it is attached to an OpenGL ES renderbuffer. Your application should set these properties before passing this object into the EAGLContext method renderbufferStorage:fromDrawable:. If you change the drawableProperties dictionary, your application must call renderbufferStorage:fromDrawable: again on the context for the new values to take effect.

Availability
  • Available in iOS 2.0 and later.
Declared In
EAGLDrawable.h

Constants

Drawable Property Keys

Keys to specify in the drawableProperties dictionary.

EAGL_EXTERN NSString * const kEAGLDrawablePropertyColorFormat;
EAGL_EXTERN NSString * const kEAGLDrawablePropertyRetainedBacking;
Constants
kEAGLDrawablePropertyColorFormat

The key specifying the internal color buffer format for the drawable surface. The value for this key is an NSString object that specifies a specific color buffer format. This color buffer format is used by the EAGLContext object to create the storage for a renderbuffer. The default value is kEAGLColorFormatRGBA8.

Available in iOS 2.0 and later.

Declared in EAGLDrawable.h.

kEAGLDrawablePropertyRetainedBacking

The key specifying whether the drawable surface retains its contents after displaying them. The value for this key is an NSNumber object containing a BOOL data type. If NO, you may not rely on the contents being the same after the contents are displayed. If YES, then the contents will not change after being displayed. Setting the value to YES is recommended only when you need the content to remain unchanged, as using it can result in both reduced performance and additional memory usage. The default value is NO.

Available in iOS 2.0 and later.

Declared in EAGLDrawable.h.

Color Formats

Color formats that can be specified under the kEAGLDrawablePropertyColorFormat key.

EAGL_EXTERN NSString * const kEAGLColorFormatRGB565;
EAGL_EXTERN NSString * const kEAGLColorFormatRGBA8;
Constants
kEAGLColorFormatRGB565

Specifies a 16-bit RGB format that corresponds to the OpenGL ES GL_RGB565 format.

Available in iOS 2.0 and later.

Declared in EAGLDrawable.h.

kEAGLColorFormatRGBA8

Specifies a 32-bit RGBA format that corresponds to the OpenGL ES GL_RGBA8888 format.

Available in iOS 2.0 and later.

Declared in EAGLDrawable.h.