So I dont quite understand why MyGUI needs a pointer to a scene manager... I use multiple scene managers in my app and I am not sure how/where to create MyGUI. I tried creating a dedicated scene manager JUST for MyGUI, but nothing would display when I did that. If MyGUI already has a pointer to the render target I want to use, why does it care what scene manager it uses? Why cant I stick it in its own isolated scene manager, which would allow me to create everything at app init (before the 'main' game scene manager is created)?
Just a theory, but couldn't you feasibly do that by creating a scenemanager with one camera, with the viewport on top of all of your other scene manager's viewports and make the background transparent?
By the way, excellent idea, and I believe I'll try this...
I was able to get MyGUI to initialize with a separate scene manager and layer it on top of others:
const bool Game::_initGUI()
mOP = new MyGUI::OgrePlatform();
mGUI = new MyGUI::Gui();
if((mGUI != 0) && (mOP != 0))
mGuiSM = Ogre::Root::getSingleton().createSceneManager(Ogre::ST_GENERIC, "GUI");
if(mGuiSM != 0)
snGuiCam = mGuiSM->getRootSceneNode()->createChildSceneNode("GuiCamNode");
//Note: This is my custom camera class initialization wrapper
mGuiCam = new Gfx::Camera( "GuiCam", snGuiCam, mRenderer->getRenderWindow(), //Name, SceneNode, RenderWindow
gAspect, true, //Apsect Ratio, CreateNewViewport
Ogre::Real(0), Ogre::Real(0), //Left, Top
Ogre::Real(1.0), Ogre::Real(1.0), //Width, Height
Ogre::Real(2), Ogre::Real(20), //Near Clip, Far Clip
Ogre::ColourValue(0.0, 0.0, 0.0, 1.0), //Background Color
mGuiCam->getViewport()->setClearEveryFrame(true, Ogre::FBT_DEPTH); //Allow the background to be transparent
mOP->initialise(mRenderer->getRenderWindow(), mGuiSM, "GUI");
MyGUI::Button* btnTest = mGUI->createWidget<MyGUI::Button>("Button", 10, 10, 300, 30, MyGUI::Align::Default, "Main");
logMessage("!!! Failed !!!");
However, I can't seem to make it display with or without the other SceneManager, so something is going on...