iOS Developer Library — Pre-Release

Developer

OpenGLES Framework Reference EAGLDrawable Protocol Reference

Options
Deployment Target:

On This Page
Language:

EAGLDrawable

Inheritance


Not Applicable

Conforms To


Not Applicable

Import Statement


Swift

import OpenGLES

Objective-C

@import OpenGLES;

Availability


Available in iOS 2.0 and later.

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.

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

    Declaration

    Swift

    var drawableProperties: [NSObject : AnyObject]! { get set }

    Objective-C

    @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.

    Import Statement

    Objective-C

    @import OpenGLES;

    Swift

    import OpenGLES

    Availability

    Available in iOS 2.0 and later.

  • Keys to specify in the drawableProperties dictionary.

    Declaration

    Swift

    let kEAGLDrawablePropertyColorFormat: String let kEAGLDrawablePropertyRetainedBacking: String

    Objective-C

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

    Constants

    • kEAGLDrawablePropertyColorFormat

      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.

    • kEAGLDrawablePropertyRetainedBacking

      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 NOfalse, you may not rely on the contents being the same after the contents are displayed. If YEStrue, then the contents will not change after being displayed. Setting the value to YEStrue 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 NOfalse.

      Available in iOS 2.0 and later.

  • Color formats that can be specified under the kEAGLDrawablePropertyColorFormat key.

    Declaration

    Swift

    let kEAGLColorFormatRGB565: String let kEAGLColorFormatRGBA8: String

    Objective-C

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

    Constants

    • kEAGLColorFormatRGB565

      kEAGLColorFormatRGB565

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

      Available in iOS 2.0 and later.

    • kEAGLColorFormatRGBA8

      kEAGLColorFormatRGBA8

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

      Available in iOS 2.0 and later.