SplitViewController Orientation Problems

Discussion of issues specific to mobile platforms such as iOS, Android, Symbian and Meego.
rado0x54
Gnoblar
Posts: 14
Joined: Fri Jul 08, 2011 5:38 pm
x 1

SplitViewController Orientation Problems

Post by rado0x54 »

Hello,

I'm very new to Ogre, but I'm already quite excited. :). I build Ogre 1.8 from Source installed the Xcode templates and got the Demo Application running without any flaws. Orientation changes worked perfectly.

Now I wanted to move the EAGL2ViewController into a Splitviewcontroller. I changed the demo by adding this:

Code: Select all

    
    [self go];
    
    self.vc = [[TestViewController alloc] init];

     Ogre::RenderWindow *mWindow = Ogre::Root::getSingleton().getAutoCreatedWindow();
     
     UIWindow *mUIWindow = nil;
     mWindow->getCustomAttribute("WINDOW", &mUIWindow);
    EAGL2ViewController *EAGL2vc = (EAGL2ViewController *)mUIWindow.rootViewController;
    
    // remove from UIWindow
    [EAGL2vc.view removeFromSuperview];
    
    UISplitViewController *splitViewController = [[UISplitViewController alloc] init];
    splitViewController.viewControllers = [NSArray arrayWithObjects:vc, EAGL2vc, nil];
    
    mUIWindow.rootViewController = splitViewController;
I only permit landscape orientation. (in Info.plist).

Unfortunately the result is this:
Image

I feel I know the cause, but so far I was not able to solve it.
OpenGL ES 2 Renderer starts up with the following message:

Code: Select all

GLES2RenderSystem::_createRenderWindow "DemoApp v1.0", 768x1024 fullscreen  miscParams: FSAA=0 contentScalingFactor=1 displayFrequency=0 Hz orientation=Landscape Right
I feel orientation should be "Portrait" since it's handled by the SplitviewController now. However, changes to ogre.cfg take absolutely no effect! :?:

I'm still not sure about the Orientation Implementation. Do I have to fix something with EAGL2ViewController or do I have to look at Ogre's Orientation Modes?

Help and Pointers would be appreciated.
Thanks!

Martin
User avatar
masterfalcon
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126

Re: SplitViewController Orientation Problems

Post by masterfalcon »

That's a good test case. I'd never tried it with a split view controller. You'll want to look at EAGL2ViewController, the orientation modes should be turned off now so that message in the log is actually irrelevant. You might also try specifying the startup orientation to see if that helps.
rado0x54
Gnoblar
Posts: 14
Joined: Fri Jul 08, 2011 5:38 pm
x 1

Re: SplitViewController Orientation Problems

Post by rado0x54 »

Interestingly, if I allow Portrait (without UpSideDown) as well (in Info.plist). It looks like this:

Image
You might also try specifying the startup orientation to see if that helps.
Any pointers of how I can do this? I feel it has to do with:

Code: Select all

NSString *initialOrientation = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UIInterfaceOrientation"];
Thanks.

Update: Btw, the EAGL2View redraws itself perfectly into (fullscreen) Portrait Mode in this case.
User avatar
masterfalcon
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126

Re: SplitViewController Orientation Problems

Post by masterfalcon »

This is probably a manifestation of another bug regarding orientation that I was tracking. I'll take a look at it tonight if I can.
rado0x54
Gnoblar
Posts: 14
Joined: Fri Jul 08, 2011 5:38 pm
x 1

Re: SplitViewController Orientation Problems

Post by rado0x54 »

Ok, no problem. I'll probably won't use the SplitViewController anyway for the problem I have to solve.

Just one more hint. This definitely comes from the same issue.

If I take the EAGL2View and place it somewhere in my TestView(Controller) it only works if I have a Portrait Option enabled in the Info.plist. Otherwise it's also translated by 90deg.

Code: Select all

    [self go];
    
    self.vc = [[TestViewController alloc] init];
    
    Ogre::RenderWindow *mWindow = Ogre::Root::getSingleton().getAutoCreatedWindow();
    UIWindow *mUIWindow = nil;
    mWindow->getCustomAttribute("WINDOW", &mUIWindow);
    EAGL2ViewController *EAGL2vc = (EAGL2ViewController *)mUIWindow.rootViewController;

    
    [EAGL2vc.view removeFromSuperview];
    
    /* SPLITVIEW
    // remove from UIWindow
    
    UISplitViewController *splitViewController = [[UISplitViewController alloc] init];
    splitViewController.viewControllers = [NSArray arrayWithObjects:vc, EAGL2vc, nil];
    
    mUIWindow.rootViewController = splitViewController;
    */ 
    
    [vc.view addSubview:EAGL2vc.view];
    EAGL2vc.view.frame = CGRectMake(200,200,400,400);
    
    mUIWindow.rootViewController = vc;
Image

If I enable Portrait in Info.plist everything works fine (EAGL2View rotates nicely). As a workaround I can disable Portrait Mode as a supported shouldAutorotateToInterfaceOrientation in my TestViewController.

This project is truly amazing and I hope I can give something back to the community soon!
SFAOK
Kobold
Posts: 32
Joined: Thu May 20, 2004 9:22 pm

Re: SplitViewController Orientation Problems

Post by SFAOK »

Has anyone managed to get a split-view (ogre in one view, cocoa touch in another) working in XCode 4.3 / Ogre 1.8 with latest build/templates?

I've been searching the forums for a while now and I keep on returning to this thread. The problem is the code seems to be depreciated for my build.

For example with the first two lines of code:

Code: Select all

 [self go];
    
    self.vc = [[TestViewController alloc] init];
I find only one [self go] reference in the demo app, but xcode will complain there's no such thing as self.vc. Same goes for EAGL2ViewController - doesn't seem to exist in 1.8.