Multiple scene managers...

ZealAddon

18-02-2010 02:02:54

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)?

xypher

06-05-2010 03:00:40

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...

xypher

08-05-2010 18:37:07

I was able to get MyGUI to initialize with a separate scene manager and layer it on top of others:


const bool Game::_initGUI()
{
logMessage("Instantiating GUI...");
MyGUI::LogManager::registerSection(MYGUI_PLATFORM_LOG_SECTION, "MyGUI.log");
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
1000); //ZOrder

mGuiCam->getViewport()->setClearEveryFrame(true, Ogre::FBT_DEPTH); //Allow the background to be transparent

mOP->initialise(mRenderer->getRenderWindow(), mGuiSM, "GUI");
mGUI->initialise();

mGUI->setVisiblePointer(true);

MyGUI::Button* btnTest = mGUI->createWidget<MyGUI::Button>("Button", 10, 10, 300, 30, MyGUI::Align::Default, "Main");
btnTest->setCaption("Quit");

logMessage("Finished.");
return true;
}
}

logMessage("!!! Failed !!!");
return false;
}


However, I can't seem to make it display with or without the other SceneManager, so something is going on...