GLKView set drawable properties

If you want to get kEAGLDrawablePropertyRetainedBacking in a GLKView, add the following category to your project.

@interface CAEAGLLayer (Retained)

@end 

@implementation CAEAGLLayer (Retained)

- (NSDictionary*) drawableProperties
{
    return @{kEAGLDrawablePropertyRetainedBacking : @(YES)};
}

@end

Setting the drawableProperties on the CAEAGLLayer maintained by the GLKView doesn’t work because the GLKView overwrites those properties when it binds its drawable and generates its render storage. Using this method forces the GLKView to use your category’s returned drawableProperties instead.

Leave a Comment