I have a problem with openGL and orientation in my iPad app. The problem only happens with 4.3+ devices. It doesn't happen with 4.2 devices.
When I start the application with any orientation and draw, it draws correctly, but when I change the orientation, and try to draw, the iPad restarts itself. The restart happens on the call
[context presentRenderbuffer:GL_RENDERBUFFER_OES];
This is the code I use in layoutSubviews:
-(void) layoutSubviews {
[EAGLContext setCurrentContext:context];
glBindRenderbufferOES(GL_RENDERBUFFER_OES, viewRenderbuffer);
[context renderbufferStorage:GL_RENDERBUFFER_OES fromDrawable:(id<EAGLDrawable>) [self layer]];
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &backingWidth);
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &backingHeight);
glScissor(0, 0, [self bounds].size.width, [self bounds].size.height);
NSLog(@"%f - %f", [self bounds].size.width, [self bounds].size.height);
glBindRenderbufferOES(GL_RENDERBUFFER_OES, depthRenderbuffer);
glRenderbufferStorageOES(GL_RENDERBUFFER_OES, GL_DEPTH_COMPONENT16_OES, backingWidth, backingHeight);
[self erase];
[self drawExisting];
glBindRenderbufferOES(GL_RENDERBUFFER_OES, viewRenderbuffer);
[context presentRenderbuffer:GL_RENDERBUFFER_OES];
}
My question is, did anything change is 4.3? I cant find anything that states that. Or if you see anything wrong in my code, please let me know.