Hello,
I wanted to put my EAGL layer context inside a UIViewController (instead of a regular UIView as per the sample apps) as follows:
Code:
- (id)init {
if (self = [super init]) {
// Get the layer
CAEAGLLayer *eaglLayer = (CAEAGLLayer*) self.view.layer;
eaglLayer.opaque = YES;
eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:FALSE], kEAGLDrawablePropertyRetainedBacking, kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat, nil];
context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES1];
if(!context || ![EAGLContext setCurrentContext:context] || ![self createFramebuffer]) {
[self release];
returnnil;
}
[self setupView];
[self drawView];
}
returnself;
}
All i did was change some self.layer to self.view.layer
It built with no errors but then I get a crash with the following message:
2011-01-23 14:43:24.791 MyApp[36059:207] -[CALayer setDrawableProperties:]: unrecognized selector sent to instance 0x4b37cd0
2011-01-23 14:43:24.793 MyApp[36059:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CALayer setDrawableProperties:]: unrecognized selector sent to instance 0x4b37cd0'
I've been searching around but haven't been able to resolve this; can anyone help out? Thanks.