I’m porting a C++-based engine from Android to iOS and I have some questions on how landscape mode on iOS devices work.
I can successfully start my device on landscape mode but my framebuffer stays on portrait mode no matter how I rotate it (or force its rotation). For instance, I would expect a 960×640 resolution instead of the default 320×480.
I’ve been researching about it and I saw some people doing this but explicitly rotating the scene using OpenGL, which means the actual axis were not in landscape mode, which for me is an ugly workaround.
Make sure your OpenGL UIView is attached to a UIViewController and not inserted directly into the UIWindow. To do that, create a custom view controller:
Then add it to your app’s window via the AppDelegate:
self.window is just the app’s UIWindow, you may have to change that if you store the window somewhere else.
After that, the UIViewController takes care of rotations and resizing your view when the device is turned and you can override the layoutSubviews method in your MyEAGLView object to handle resizing the OpenGL context. You may also want to look at Apple’s sample code for OpenGL apps since it correctly handles this stuff.