I have an issue with auto rotation in where I want a specific view to stay always in portrait mode.
One suggestion I found was to just rotate the view back when a landscape rotation is detected like this:
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
duration:(NSTimeInterval)duration
{
float rotation;
if (toInterfaceOrientation==UIInterfaceOrientationPortrait) {
rotation = 0;
}
else
if (toInterfaceOrientation==UIInterfaceOrientationLandscapeLeft) {
rotation = M_PI_2;
}
else
if (toInterfaceOrientation==UIInterfaceOrientationLandscapeRight) {
rotation = -M_PI_2;
}
videoWindow.transform = CGAffineTransformMakeRotation(rotation);
openGLView.transform = CGAffineTransformMakeRotation(rotation);
}
So the result is that, whenever the user changes to landscape mode the video view is correctly rotated back so it will look good as if it didn't rotate from the first place.
My issue is with the OpenGL view. When I rotate it back the contents of my OpenGL drawings get distorted until they fail and I get an error on the log saying "Failed to make complete framebuffer object 8cd6"
Now, if I comment the previous code and let the viewcontroller autorotate the OpenGL view it does get rotated and nothing gets distorted (but in landscape the measures don't fit.
So my question is, how does apple rotate things on device rotation detected so that I can simulate the exact process backwards to achieve a simulated rotation locked-OpenGL view.