I have a problem with openGL and orientation in my iPad app. The problem occurs only with 4.3+ devices. This does not happen with 4.2 devices.
When I launch the application with any orientation and draw, it draws correctly, but when I change orientation and try to draw, the iPad restarts. Restart occurs on call
[context presentRenderbuffer:GL_RENDERBUFFER_OES]
This is the code I'm using 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: has something changed - 4.3? I cannot find anything that claims this. Or, if you see something wrong in my code, let me know.
Basel source
share