I know the documentation and forum posts talk about createRenderWindow, but I was curious about the thoughts of expanding initialise to take in the extra params. My rationale is that with the extra params, any config done by the normal initialise function will get picked up. For example OgreOSXGLSupport.m, sets things based on config before instantiating the window.
If you call createRenderWindow, but don't have the same miscParams, then you may get different "default" config for the given platform. This way, it seems to me you can minimize on-boarding by having defaults which work. It is a little frustrating that you need to have a ogre.cfg versus it being able to know its target and at least pick a vanilla version that runs. Please note this probably does not affect those that are further in dev with Ogre or have had previous experience.
In either case, I did make a mod like this already. The function looks like:
Code: Select all
RenderWindow* initialise(bool autoCreateWindow, const String& windowTitle = "OGRE Render Window",
const String& customCapabilitiesConfig = StringUtil::BLANK, const NameValuePairList& extraParams = NameValuePairList());
Code: Select all
Ogre::NameValuePairList pairList;
OgreSampleAppDelegate* delegate;
#if TARGET_OS_IPHONE
OgreSampleViewController* viewController;
delegate = (OgreSampleAppDelegate*) [[UIApplication sharedApplication] delegate];
viewController = (OgreSampleViewController*) delegate.window.rootViewController;
EAGL2View* view = viewController.view2;
pairList["externalWindowHandle"] = Ogre::StringConverter::toString((unsigned long)delegate.window);
pairList["externalViewHandle"] = Ogre::StringConverter::toString((unsigned long)view);
#else
delegate = (OgreSampleAppDelegate*) [[NSApplication sharedApplication] delegate];
OgreView* view = [delegate.window contentView];
pairList["externalWindowHandle"] = Ogre::StringConverter::toString((unsigned long)view);
#endif
#if TARGET_OS_IPHONE
pairList["externalViewControllerHandle"] = Ogre::StringConverter::toString((unsigned long)viewController);
#endif
mWindow = mRoot->initialise(true, "TutorialApplication Render Window", Ogre::StringUtil::BLANK, pairList);Crazy? Better way to do this? I'm hear to learn if there is!
BTW, I also see that having extraParams could be convenient later on if there are some other initialization elements that are desired from the call.
Thanks!
