I'm suffering a strange bug regarding orientations. I'm using the device in landscape right mode, so I create the window using the bounds of the parent view (which is shown in a right way), the bounds are width 480 and height 320.
Next, the window is created, into "EAGL2Window::create" mWidth is assigned to 480 and mHeight to 320, all ok at this moment.
But we arrive to initNativeCreatedWindow, here the mWidth and mHeight params are not taken in account, it creates the view using mGLSupport->......find("Video Mode"). This Video Mode says that my window must have a width of 300 and a height of 480 , and the view is created using this dimensions but the FrameBuffer is using a backing width of 480 and height of 300:
At last, it goes to resize function and the line: UIInterfaceOrientationIsPortrait(mViewController.interfaceOrientation) returns false, so the w *= std::max(width, height); h *= std::min(width, height); returns w=480 and h=300 (which is not true) and as the resize function has received the same parameters, it doesn't resize anything.iOS: Window created 300 x 480 with backing store size 480 x 300 using content scaling factor 1.0
The final result of this, is that my ogre view is rotated 90º and it only covers the half of the screen (300 pixels).
For more information: i'm passing a custom window to destroy it after ogre init and attach the ogre view to my parent view (this view is perfectly fit in the screen) and the dummy window is also created with the same params. I've try also without passing a custom window and let ogre to create them, without success.
I'm not an expert on iOS programming, so its easy that i've forgot something or to add some line of code to deal with orientations
I think that the problem comes from take the resolution from mGLSupport->......find("Video Mode") instead of using the passed params. And i haven't also any idea where is the file where these "Video Mode" values are read.
Any idea of how solve the problem?
I'm using iOS 5.1 and XCode 4.3.3 running over an iPhone 3GS with iOS 5.1.1
Thanks in advance!
