Only use the shader based mygui manager if the fixed pipeline is unavailable

actorid
scrawl 12 years ago
parent 2c8b0a1541
commit 21bdcc9f20

@ -559,6 +559,8 @@ void MyGUIManager::setup(Ogre::RenderWindow *wnd, Ogre::SceneManager *mgr, bool
assert(mgr); assert(mgr);
mSceneMgr = mgr; mSceneMgr = mgr;
mShaderRenderManager = NULL;
mRenderManager = NULL;
using namespace MyGUI; using namespace MyGUI;
@ -574,7 +576,10 @@ void MyGUIManager::setup(Ogre::RenderWindow *wnd, Ogre::SceneManager *mgr, bool
// Set up OGRE platform (bypassing OgrePlatform). We might make this more generic later. // Set up OGRE platform (bypassing OgrePlatform). We might make this more generic later.
mLogManager = new LogManager(); mLogManager = new LogManager();
mRenderManager = new MyGUI::ShaderBasedRenderManager(); if (!Ogre::Root::getSingleton().getRenderSystem()->getCapabilities()->hasCapability(Ogre::RSC_FIXED_FUNCTION))
mShaderRenderManager = new MyGUI::ShaderBasedRenderManager();
else
mRenderManager = new MyGUI::OgreRenderManager();
mDataManager = new MyGUI::FixedOgreDataManager(); mDataManager = new MyGUI::FixedOgreDataManager();
LogManager::getInstance().setSTDOutputEnabled(logging); LogManager::getInstance().setSTDOutputEnabled(logging);
@ -582,7 +587,10 @@ void MyGUIManager::setup(Ogre::RenderWindow *wnd, Ogre::SceneManager *mgr, bool
if (!theLogFile.empty()) if (!theLogFile.empty())
LogManager::getInstance().createDefaultSource(theLogFile); LogManager::getInstance().createDefaultSource(theLogFile);
mRenderManager->initialise(wnd, mgr); if (mShaderRenderManager)
mShaderRenderManager->initialise(wnd, mgr);
else
mRenderManager->initialise(wnd, mgr);
mDataManager->initialise("General"); mDataManager->initialise("General");
// Create GUI // Create GUI
@ -592,8 +600,16 @@ void MyGUIManager::setup(Ogre::RenderWindow *wnd, Ogre::SceneManager *mgr, bool
void MyGUIManager::updateWindow (Ogre::RenderWindow *wnd) void MyGUIManager::updateWindow (Ogre::RenderWindow *wnd)
{ {
mRenderManager->setRenderWindow (wnd); if (mShaderRenderManager)
mRenderManager->setActiveViewport(0); {
mShaderRenderManager->setRenderWindow (wnd);
mShaderRenderManager->setActiveViewport(0);
}
else
{
mRenderManager->setRenderWindow (wnd);
mRenderManager->setActiveViewport(0);
}
} }
void MyGUIManager::shutdown() void MyGUIManager::shutdown()
@ -606,6 +622,12 @@ void MyGUIManager::shutdown()
delete mRenderManager; delete mRenderManager;
mRenderManager = NULL; mRenderManager = NULL;
} }
if(mShaderRenderManager)
{
mShaderRenderManager->shutdown();
delete mShaderRenderManager;
mShaderRenderManager = NULL;
}
if(mDataManager) if(mDataManager)
{ {
mDataManager->shutdown(); mDataManager->shutdown();

@ -8,6 +8,7 @@ namespace MyGUI
class Gui; class Gui;
class LogManager; class LogManager;
class OgreDataManager; class OgreDataManager;
class OgreRenderManager;
class ShaderBasedRenderManager; class ShaderBasedRenderManager;
} }
@ -25,12 +26,12 @@ namespace GUI
MyGUI::Gui *mGui; MyGUI::Gui *mGui;
MyGUI::LogManager* mLogManager; MyGUI::LogManager* mLogManager;
MyGUI::OgreDataManager* mDataManager; MyGUI::OgreDataManager* mDataManager;
MyGUI::ShaderBasedRenderManager* mRenderManager; MyGUI::OgreRenderManager* mRenderManager;
MyGUI::ShaderBasedRenderManager* mShaderRenderManager;
Ogre::SceneManager* mSceneMgr; Ogre::SceneManager* mSceneMgr;
public: public:
MyGUIManager() : mLogManager(NULL), mDataManager(NULL), mRenderManager(NULL), mGui(NULL) {}
MyGUIManager(Ogre::RenderWindow *wnd, Ogre::SceneManager *mgr, bool logging=false, const std::string& logDir = std::string("")) MyGUIManager(Ogre::RenderWindow *wnd, Ogre::SceneManager *mgr, bool logging=false, const std::string& logDir = std::string(""))
{ {
setup(wnd,mgr,logging, logDir); setup(wnd,mgr,logging, logDir);

Loading…
Cancel
Save