Support screen rotation in OpenGL as well.

This commit is contained in:
Henrik Rydgård committed 2025-10-22 15:19:12 +02:00
1 parent 1c49ad7b29
commit c5dcb0009c
1 file changed
+17
+17
View File
@@ -643,6 +643,23 @@ void GLRenderLoop(IOSGLESContext *graphicsContext) {
[self hideKeyboard];
}
- (void)viewWillTransitionToSize:(CGSize)size
withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator {
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
[self.view endEditing:YES]; // clears any input focus
[coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) {
NSLog(@"Rotating to size: %@", NSStringFromCGSize(size));
} completion:^(id<UIViewControllerTransitionCoordinatorContext> context) {
NSLog(@"Rotation finished");
// Reinitialize graphics context to match new size
[self requestExitGLRenderLoop];
[self runGLRenderLoop];
[[DisplayManager shared] updateResolution:[UIScreen mainScreen]];
}];
}
@end
void bindDefaultFBO()