majorconfusion
09-12-2010 03:46:57
Dear QuickGUI'ers
I'm having great difficulty understanding how to integrate QuickGUI into my existing project which uses Ogre to render. I've just downloaded the latest QuickGUI trunk from SVN, and I'm using the Ogre binary SDK download for Windows (1.7.1).
My GUI initialisation code follows (pinched from the demo). Ogre has already been initialised by the time this runs.
This code is failing at the 'm_scene = new QuickGUIOgrePlatform::Scene...' line, with an Ogre::InvalidParametersException "Can't create another viewport for OGRE Render Window with Z-Order 0 because a viewport exists with this Z-Order already.".
Delving a little into the QuickGUIOgrePlatform code (the Scene constructor), it appears it is trying to create another scene manager, camera and viewport - using the same name as my existing one.
So... am I initialising QuickGUI and its OgrePlatform in the right manner? If so, does QuickGUI's OgrePlatform want to control the creation of the Ogre scene manager, or does QuickGUI utilise an internal scene manager for its own rendering purposes?
Any help appreciated.
PS. It appears that missing skin files will cause a crash in the loadSkins function. Happy to put together a patch to handle this more gracefully with an exception - if it will be accepted?
I'm having great difficulty understanding how to integrate QuickGUI into my existing project which uses Ogre to render. I've just downloaded the latest QuickGUI trunk from SVN, and I'm using the Ogre binary SDK download for Windows (1.7.1).
My GUI initialisation code follows (pinched from the demo). Ogre has already been initialised by the time this runs.
This code is failing at the 'm_scene = new QuickGUIOgrePlatform::Scene...' line, with an Ogre::InvalidParametersException "Can't create another viewport for OGRE Render Window with Z-Order 0 because a viewport exists with this Z-Order already.".
Delving a little into the QuickGUIOgrePlatform code (the Scene constructor), it appears it is trying to create another scene manager, camera and viewport - using the same name as my existing one.
So... am I initialising QuickGUI and its OgrePlatform in the right manner? If so, does QuickGUI's OgrePlatform want to control the creation of the Ogre scene manager, or does QuickGUI utilise an internal scene manager for its own rendering purposes?
Any help appreciated.
PS. It appears that missing skin files will cause a crash in the loadSkins function. Happy to put together a patch to handle this more gracefully with an exception - if it will be accepted?
try {
m_gui_resource_manager = new QuickGUIOgrePlatform::ResourceManager();
m_gui = new QuickGUI::Core(m_gui_resource_manager);
// Register all Skins we plan on using
QuickGUI::SkinManager* skinMgr = QuickGUI::SkinManager::getSingletonPtr();
skinMgr->loadSkins("skins/Button.skin");
skinMgr->loadSkins("skins/CheckBox.skin");
skinMgr->loadSkins("skins/Graphic.skin");
skinMgr->loadSkins("skins/HScrollBar.skin");
skinMgr->loadSkins("skins/Label.skin");
skinMgr->loadSkins("skins/MouseCursor.skin");
skinMgr->loadSkins("skins/Panel.skin");
skinMgr->loadSkins("skins/ProgressBar.skin");
skinMgr->loadSkins("skins/RadioButton.skin");
skinMgr->loadSkins("skins/TextCursor.skin");
skinMgr->loadSkins("skins/TitleBar.skin");
skinMgr->loadSkins("skins/TextBox.skin");
skinMgr->loadSkins("skins/VScrollBar.skin");
skinMgr->loadSkins("skins/Window.skin");
skinMgr->loadSkins("skins/Ogre.skin");
Ogre::Root* root = Ogre::Root::getSingletonPtr();
m_scene = new QuickGUIOgrePlatform::Scene(root->getAutoCreatedWindow());
QuickGUI::Interface* mInterface = QuickGUI::Core::getSingletonPtr()->createInterface("MainWindow",m_scene);
mInterface->getMouseCursor()->setSkin(QuickGUI::SkinManager::getSingletonPtr()->getSkin("MouseCursor"));
QuickGUI::Size winSize(250,250);
QuickGUI::Window* newWin = mInterface->createWindow("Test");
newWin->setSize(winSize);
newWin->setSkin(QuickGUI::SkinManager::getSingletonPtr()->getSkin("Window"));
newWin->setResizable(true);
newWin->setMaxSize(QuickGUI::Size(400,400));
newWin->setMinSize(QuickGUI::Size(100,100));
} catch (Ogre::Exception e) {
throw GuiManagerException(e.what());
} catch (...) {
throw GuiManagerException("Failed to initialise GUI");
}