From 29be5312a01cb460684eb6839378868b08073ec4 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 13 Jun 2007 11:09:31 +0000 Subject: [PATCH] Added OSG_SCREEN and OSG_WINDOW env var checking in the Viewer::realize() --- src/osgViewer/Viewer.cpp | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/src/osgViewer/Viewer.cpp b/src/osgViewer/Viewer.cpp index 11999f021..be35755fa 100644 --- a/src/osgViewer/Viewer.cpp +++ b/src/osgViewer/Viewer.cpp @@ -21,6 +21,8 @@ #include +#include + using namespace osgViewer; @@ -1042,6 +1044,8 @@ struct ViewerRunOperations : public osg::Operation }; static osg::ApplicationUsageProxy Viewer_e0(osg::ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_THREADING ","Set the threading model using by Viewer, can be SingleThreaded, CullDrawThreadPerContext, DrawThreadPerContext or CullThreadPerCameraDrawThreadPerContext."); +static osg::ApplicationUsageProxy Viewer_e1(osg::ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_SCREEN ","Set the default screen that windows should open up on."); +static osg::ApplicationUsageProxy Viewer_e2(osg::ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_WINDOW x y width height","Set the default window dimensions that windows should open up on."); Viewer::ThreadingModel Viewer::suggestBestThreadingModel() { @@ -1675,11 +1679,35 @@ void Viewer::realize() osg::notify(osg::INFO)<<"Viewer::realize() - No valid contexts found, setting up view across all screens."<> x >> y >> width >> height; + } + + if (width>0 && height>0) + { + if (screenNum>=0) setUpViewInWindow(x, y, width, height, screenNum); + else setUpViewInWindow(x,y,width,height); + } + else if (screenNum>=0) + { + setUpViewOnSingleScreen(screenNum); + } + else + { + setUpViewAcrossAllScreens(); + } getContexts(contexts); }