[Orxonox-commit 3343] r8031 - code/branches/usability/src/libraries/core

landauf at orxonox.net landauf at orxonox.net
Sun Mar 6 14:02:19 CET 2011


Author: landauf
Date: 2011-03-06 14:02:18 +0100 (Sun, 06 Mar 2011)
New Revision: 8031

Modified:
   code/branches/usability/src/libraries/core/GraphicsManager.cc
Log:
added workaround for systems (linux?) where there's no color depth written to the ogre.cfg file. hope this works, couldn't test it here.

Modified: code/branches/usability/src/libraries/core/GraphicsManager.cc
===================================================================
--- code/branches/usability/src/libraries/core/GraphicsManager.cc	2011-03-06 12:42:26 UTC (rev 8030)
+++ code/branches/usability/src/libraries/core/GraphicsManager.cc	2011-03-06 13:02:18 UTC (rev 8031)
@@ -511,7 +511,25 @@
 
     std::string GraphicsManager::setScreenResolution(unsigned int width, unsigned int height, bool fullscreen)
     {
-        this->ogreRoot_->getRenderSystem()->setConfigOption("Video Mode", multi_cast<std::string>(width) + " x " + multi_cast<std::string>(height) + " @ " + multi_cast<std::string>(this->getRenderWindow()->getColourDepth()) + "-bit colour");
+        // workaround to detect if the colour depth should be written to the config file
+        bool bWriteColourDepth = false;
+        Ogre::ConfigOptionMap& options = ogreRoot_->getRenderSystem()->getConfigOptions();
+        Ogre::ConfigOptionMap::iterator it = options.find("Video Mode");
+        if (it != options.end())
+            bWriteColourDepth = (it->second.currentValue.find('@') != std::string::npos);
+
+        if (bWriteColourDepth)
+        {
+            this->ogreRoot_->getRenderSystem()->setConfigOption("Video Mode", multi_cast<std::string>(width)
+                                                                    + " x " + multi_cast<std::string>(height)
+                                                                    + " @ " + multi_cast<std::string>(this->getRenderWindow()->getColourDepth()) + "-bit colour");
+        }
+        else
+        {
+            this->ogreRoot_->getRenderSystem()->setConfigOption("Video Mode", multi_cast<std::string>(width)
+                                                                    + " x " + multi_cast<std::string>(height));
+        }
+
         this->ogreRoot_->getRenderSystem()->setConfigOption("Full Screen", fullscreen ? "Yes" : "No");
 
         std::string validate = this->ogreRoot_->getRenderSystem()->validateConfigOptions();




More information about the Orxonox-commit mailing list