]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/WindowBuilder.cxx
Make the number of shadow cascades and the range of each configurable
[flightgear.git] / src / Main / WindowBuilder.cxx
index 2ca83cfc63c7ccb106c5bf51528f1da15aecbf30..239a5e67550ce48e5914c85f809946fc1fd70707 100644 (file)
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
 #include "WindowBuilder.hxx"
 
 #include "WindowSystemAdapter.hxx"
@@ -53,12 +57,8 @@ WindowBuilder::makeDefaultTraits(bool stencil)
     GraphicsContext::WindowingSystemInterface* wsi
         = osg::GraphicsContext::getWindowingSystemInterface();
     GraphicsContext::Traits* traits = new osg::GraphicsContext::Traits;
-    traits->readDISPLAY();
-
-    unsigned screenwidth = 0;
-    unsigned screenheight = 0;
-    wsi->getScreenResolution(*traits, screenwidth, screenheight);
 
+    traits->readDISPLAY();
     if (traits->displayNum < 0)
         traits->displayNum = 0;
     if (traits->screenNum < 0)
@@ -76,11 +76,15 @@ WindowBuilder::makeDefaultTraits(bool stencil)
     if (stencil)
         traits->stencil = 8;
 
+    unsigned screenwidth = 0;
+    unsigned screenheight = 0;
+    wsi->getScreenResolution(*traits, screenwidth, screenheight);
+
     traits->doubleBuffer = true;
     traits->mipMapGeneration = true;
     traits->windowName = "FlightGear";
     // XXX should check per window too.
-    traits->sampleBuffers = fgGetBool("/sim/rendering/multi-sample-buffers", traits->sampleBuffers);
+    traits->sampleBuffers = fgGetInt("/sim/rendering/multi-sample-buffers", traits->sampleBuffers);
     traits->samples = fgGetInt("/sim/rendering/multi-samples", traits->samples);
     traits->vsync = fgGetBool("/sim/rendering/vsync-enable", traits->vsync);
     traits->windowDecoration = !fgGetBool("/sim/startup/fullscreen");
@@ -90,6 +94,7 @@ WindowBuilder::makeDefaultTraits(bool stencil)
         traits->supportsResize = false;
         traits->width = screenwidth;
         traits->height = screenheight;
+        SG_LOG(SG_VIEW,SG_DEBUG,"Using full screen size for window: " << screenwidth << " x " << screenheight);
     } else {
         // window
         int w = fgGetInt("/sim/startup/xsize");
@@ -102,6 +107,7 @@ WindowBuilder::makeDefaultTraits(bool stencil)
             traits->x = ((unsigned)w>screenwidth) ? 0 : (screenwidth-w)/3;
             traits->y = ((unsigned)h>screenheight) ? 0 : (screenheight-h)/3;
         }
+        SG_LOG(SG_VIEW,SG_DEBUG,"Using initial window size: " << w << " x " << h);
     }
     return traits;
 }
@@ -245,7 +251,7 @@ GraphicsWindow* WindowBuilder::getDefaultWindow()
             ->registerWindow(gc, defaultWindowName);
         return defaultWindow;
     } else {
-        SG_LOG(SG_GENERAL, SG_ALERT, "getDefaultWindow: failed to create GraphicsContext");
+        SG_LOG(SG_VIEW, SG_ALERT, "getDefaultWindow: failed to create GraphicsContext");
         return 0;
     }
 }