diff --git a/applications/osgconv/osgconv.cpp b/applications/osgconv/osgconv.cpp index a324dd0ee..e5caea059 100644 --- a/applications/osgconv/osgconv.cpp +++ b/applications/osgconv/osgconv.cpp @@ -45,6 +45,8 @@ class MyGraphicsContext { traits->doubleBuffer = false; traits->sharedContext = 0; traits->pbuffer = true; + traits->readDISPLAY(); + traits->setUndefinedScreenDetailsToDefaultScreen(); _gc = osg::GraphicsContext::createGraphicsContext(traits.get()); diff --git a/examples/osgautocapture/osgautocapture.cpp b/examples/osgautocapture/osgautocapture.cpp index 4012c980b..938570320 100644 --- a/examples/osgautocapture/osgautocapture.cpp +++ b/examples/osgautocapture/osgautocapture.cpp @@ -249,6 +249,8 @@ int main( int argc, char **argv ) traits->width = 1 << 12; traits->height = 1 << 12; traits->pbuffer = true; + traits->readDISPLAY(); + traits->setUndefinedScreenDetailsToDefaultScreen(); } osg::ref_ptr pbuffer = osg::GraphicsContext::createGraphicsContext(traits.get()); if (pbuffer.valid()) diff --git a/examples/osgautotransform/osgautotransform.cpp b/examples/osgautotransform/osgautotransform.cpp index 599ac2228..8e540d82b 100644 --- a/examples/osgautotransform/osgautotransform.cpp +++ b/examples/osgautotransform/osgautotransform.cpp @@ -209,6 +209,8 @@ osgViewer::View* createView(osg::ref_ptr scenegraph, osg::ref_ptrwindowDecoration = true; traits->doubleBuffer = true; traits->sharedContext = 0; + traits->readDISPLAY(); + traits->setUndefinedScreenDetailsToDefaultScreen(); gc = osg::GraphicsContext::createGraphicsContext(traits.get()); if (!gc) @@ -267,7 +269,11 @@ int main(int argc, char** argv) } unsigned int width, height; - wsi->getScreenResolution(osg::GraphicsContext::ScreenIdentifier(0), width, height); + osg::GraphicsContext::ScreenIdentifier main_screen_id; + + main_screen_id.readDISPLAY(); + main_screen_id.setUndefinedScreenDetailsToDefaultScreen(); + wsi->getScreenResolution(main_screen_id, width, height); unsigned int x=0, y=0; while(arguments.read("--window", x, y, width, height)) {} @@ -283,6 +289,8 @@ int main(int argc, char** argv) traits->windowDecoration = true; traits->doubleBuffer = true; traits->sharedContext = 0; + traits->readDISPLAY(); + traits->setUndefinedScreenDetailsToDefaultScreen(); gc = osg::GraphicsContext::createGraphicsContext(traits.get()); if (!gc) diff --git a/examples/osgcamera/osgcamera.cpp b/examples/osgcamera/osgcamera.cpp index af585549e..8d9f7f8e0 100644 --- a/examples/osgcamera/osgcamera.cpp +++ b/examples/osgcamera/osgcamera.cpp @@ -83,7 +83,11 @@ void singleWindowMultipleCameras(osgViewer::Viewer& viewer) } unsigned int width, height; - wsi->getScreenResolution(osg::GraphicsContext::ScreenIdentifier(0), width, height); + osg::GraphicsContext::ScreenIdentifier main_screen_id; + + main_screen_id.readDISPLAY(); + main_screen_id.setUndefinedScreenDetailsToDefaultScreen(); + wsi->getScreenResolution(main_screen_id, width, height); osg::ref_ptr traits = new osg::GraphicsContext::Traits; traits->x = 0; @@ -93,6 +97,8 @@ void singleWindowMultipleCameras(osgViewer::Viewer& viewer) traits->windowDecoration = true; traits->doubleBuffer = true; traits->sharedContext = 0; + traits->readDISPLAY(); + traits->setUndefinedScreenDetailsToDefaultScreen(); osg::ref_ptr gc = osg::GraphicsContext::createGraphicsContext(traits.get()); if (gc.valid()) @@ -134,7 +140,11 @@ void multipleWindowMultipleCameras(osgViewer::Viewer& viewer, bool multipleScree } unsigned int width, height; - wsi->getScreenResolution(osg::GraphicsContext::ScreenIdentifier(0), width, height); + osg::GraphicsContext::ScreenIdentifier main_screen_id; + + main_screen_id.readDISPLAY(); + main_screen_id.setUndefinedScreenDetailsToDefaultScreen(); + wsi->getScreenResolution(main_screen_id, width, height); unsigned int numCameras = 6; @@ -151,6 +161,8 @@ void multipleWindowMultipleCameras(osgViewer::Viewer& viewer, bool multipleScree traits->windowDecoration = true; traits->doubleBuffer = true; traits->sharedContext = 0; + traits->readDISPLAY(); + traits->setUndefinedScreenDetailsToDefaultScreen(); osg::ref_ptr gc = osg::GraphicsContext::createGraphicsContext(traits.get()); if (gc.valid()) diff --git a/examples/osgcompositeviewer/osgcompositeviewer.cpp b/examples/osgcompositeviewer/osgcompositeviewer.cpp index 7fe5184ce..ad1a955bc 100644 --- a/examples/osgcompositeviewer/osgcompositeviewer.cpp +++ b/examples/osgcompositeviewer/osgcompositeviewer.cpp @@ -289,7 +289,11 @@ int main( int argc, char **argv ) } unsigned int width, height; - wsi->getScreenResolution(osg::GraphicsContext::ScreenIdentifier(0), width, height); + osg::GraphicsContext::ScreenIdentifier main_screen_id; + + main_screen_id.readDISPLAY(); + main_screen_id.setUndefinedScreenDetailsToDefaultScreen(); + wsi->getScreenResolution(main_screen_id, width, height); osg::ref_ptr traits = new osg::GraphicsContext::Traits; traits->x = 100; @@ -299,6 +303,8 @@ int main( int argc, char **argv ) traits->windowDecoration = true; traits->doubleBuffer = true; traits->sharedContext = 0; + traits->readDISPLAY(); + traits->setUndefinedScreenDetailsToDefaultScreen(); osg::ref_ptr gc = osg::GraphicsContext::createGraphicsContext(traits.get()); if (gc.valid()) diff --git a/examples/osgdistortion/osgdistortion.cpp b/examples/osgdistortion/osgdistortion.cpp index 96376b4d7..18a813669 100644 --- a/examples/osgdistortion/osgdistortion.cpp +++ b/examples/osgdistortion/osgdistortion.cpp @@ -79,7 +79,11 @@ struct CommandLineOptions return; } - wsi->getScreenResolution(osg::GraphicsContext::ScreenIdentifier(0), width, height); + osg::GraphicsContext::ScreenIdentifier main_screen_id; + + main_screen_id.readDISPLAY(); + main_screen_id.setUndefinedScreenDetailsToDefaultScreen(); + wsi->getScreenResolution(main_screen_id, width, height); distance = sqrt(sphere_radius*sphere_radius - collar_radius*collar_radius); } @@ -274,6 +278,8 @@ void setDomeFaces(osgViewer::Viewer& viewer, CommandLineOptions& options) traits->windowDecoration = true; traits->doubleBuffer = true; traits->sharedContext = 0; + traits->readDISPLAY(); + traits->setUndefinedScreenDetailsToDefaultScreen(); osg::ref_ptr gc = osg::GraphicsContext::createGraphicsContext(traits.get()); if (!gc) @@ -502,6 +508,8 @@ void setDomeCorrection(osgViewer::Viewer& viewer, CommandLineOptions& options) traits->windowDecoration = false; traits->doubleBuffer = true; traits->sharedContext = 0; + traits->readDISPLAY(); + traits->setUndefinedScreenDetailsToDefaultScreen(); osg::ref_ptr gc = osg::GraphicsContext::createGraphicsContext(traits.get()); if (!gc) diff --git a/examples/osgfpdepth/osgfpdepth.cpp b/examples/osgfpdepth/osgfpdepth.cpp index 1399a1ec9..9dabd4e90 100644 --- a/examples/osgfpdepth/osgfpdepth.cpp +++ b/examples/osgfpdepth/osgfpdepth.cpp @@ -722,6 +722,8 @@ GraphicsContext* setupGC(osgViewer::Viewer& viewer, ArgumentParser& arguments) traits->windowDecoration = decoration; traits->doubleBuffer = true; traits->sharedContext = 0; + traits->readDISPLAY(); + traits->setUndefinedScreenDetailsToDefaultScreen(); ref_ptr gc = GraphicsContext::createGraphicsContext(traits.get()); osgViewer::GraphicsWindow* gw = dynamic_cast(gc.get()); diff --git a/examples/osghangglide/osghangglide.cpp b/examples/osghangglide/osghangglide.cpp index 578293d29..d13a14052 100644 --- a/examples/osghangglide/osghangglide.cpp +++ b/examples/osghangglide/osghangglide.cpp @@ -48,7 +48,7 @@ class MoveEarthySkyWithEyePointTransform : public osg::Transform { public: /** Get the transformation matrix which moves from local coords to world coords.*/ - virtual bool computeLocalToWorldMatrix(osg::Matrix& matrix,osg::NodeVisitor* nv) const + virtual bool computeLocalToWorldMatrix(osg::Matrix& matrix,osg::NodeVisitor* nv) const { osgUtil::CullVisitor* cv = dynamic_cast(nv); if (cv) @@ -63,7 +63,7 @@ public: virtual bool computeWorldToLocalMatrix(osg::Matrix& matrix,osg::NodeVisitor* nv) const { std::cout<<"computing transform"<(nv); if (cv) { @@ -99,7 +99,7 @@ osg::Group* createModel() // add the sky and base layer. transform->addChild(makeSky()); // bin number -2 so drawn first. - transform->addChild(makeBase()); // bin number -1 so draw second. + transform->addChild(makeBase()); // bin number -1 so draw second. // add the transform to the earth sky. clearNode->addChild(transform); @@ -138,14 +138,14 @@ int main( int argc, char **argv ) arguments.getApplicationUsage()->write(std::cout); return 1; } - + bool customWindows = false; while(arguments.read("-2")) customWindows = true; if (customWindows) { osg::GraphicsContext::WindowingSystemInterface* wsi = osg::GraphicsContext::getWindowingSystemInterface(); - if (!wsi) + if (!wsi) { osg::notify(osg::NOTICE)<<"View::setUpViewAcrossAllScreens() : Error, no WindowSystemInterface available, cannot create windows."<windowDecoration = true; traits->doubleBuffer = true; traits->sharedContext = 0; + traits->readDISPLAY(); + traits->setUndefinedScreenDetailsToDefaultScreen(); osg::ref_ptr gc = osg::GraphicsContext::createGraphicsContext(traits.get()); if (gc.valid()) @@ -186,17 +188,17 @@ int main( int argc, char **argv ) viewer.addSlave(camera.get(), osg::Matrixd(), osg::Matrixd::scale(aspectRatioScale,1.0,1.0)); } - } + } else { viewer.setUpViewAcrossAllScreens(); - + } // set up the camera manipulation with our custom manipultor viewer.setCameraManipulator(new GliderManipulator()); - // pass the scene graph to the viewer + // pass the scene graph to the viewer viewer.setSceneData( createModel() ); return viewer.run(); diff --git a/examples/osgmemorytest/osgmemorytest.cpp b/examples/osgmemorytest/osgmemorytest.cpp index 21fbc2a48..962897c31 100644 --- a/examples/osgmemorytest/osgmemorytest.cpp +++ b/examples/osgmemorytest/osgmemorytest.cpp @@ -57,7 +57,7 @@ class ContextTest : public MemoryTest _width(width), _height(height), _pbuffer(pbuffer) {} - + virtual osg::GraphicsContext* allocate() { osg::ref_ptr traits = new osg::GraphicsContext::Traits; @@ -65,9 +65,11 @@ class ContextTest : public MemoryTest traits->height = _height; traits->windowDecoration = true; traits->pbuffer = _pbuffer; - + traits->readDISPLAY(); + traits->setUndefinedScreenDetailsToDefaultScreen(); + osg::ref_ptr window = osg::GraphicsContext::createGraphicsContext(traits.get()); - if (window.valid()) + if (window.valid()) { if (window->realize()) { @@ -82,15 +84,15 @@ class ContextTest : public MemoryTest else { std::cerr<<"Error: Unable to create graphics context, problem with running osgViewer-"<apply(*renderInfo.getState()); - + if (renderInfo.getState()->checkGLErrors(_attribute.get())) { throw "OpenGL error"; } } - + osg::ref_ptr _attribute; }; @@ -129,40 +131,40 @@ class TextureTest : public GLMemoryTest _width(width), _height(height), _depth(depth) {} - + virtual GLObject* allocate() { if (_depth>1) { osg::ref_ptr image = new osg::Image; image->allocateImage(_width, _height, _depth, GL_RGBA, GL_UNSIGNED_BYTE); - + osg::ref_ptr texture = new osg::Texture3D; texture->setImage(image.get()); texture->setResizeNonPowerOfTwoHint(false); - + return new StateAttributeObject(texture.get()); } if (_height>1) { osg::ref_ptr image = new osg::Image; image->allocateImage(_width, _height, 1, GL_RGBA, GL_UNSIGNED_BYTE); - + osg::ref_ptr texture = new osg::Texture2D; texture->setImage(image.get()); texture->setResizeNonPowerOfTwoHint(false); - + return new StateAttributeObject(texture.get()); } if (_width>1) { osg::ref_ptr image = new osg::Image; image->allocateImage(_width, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE); - + osg::ref_ptr texture = new osg::Texture1D; texture->setImage(image.get()); texture->setResizeNonPowerOfTwoHint(false); - + return new StateAttributeObject(texture.get()); } else @@ -170,10 +172,10 @@ class TextureTest : public GLMemoryTest throw "Invalid texture size of 0,0,0"; } } - + protected: - + int _width; int _height; int _depth; @@ -191,7 +193,7 @@ class FboTest : public GLMemoryTest _width(width), _height(height), _depth(depth) {} - + virtual GLObject* allocate() { osg::ref_ptr fbo = new osg::FrameBufferObject; @@ -201,10 +203,10 @@ class FboTest : public GLMemoryTest return new StateAttributeObject(fbo.get()); } - + protected: - + int _width; int _height; int _depth; @@ -218,19 +220,19 @@ class FboTest : public GLMemoryTest class DrawableObject : public GLObject { public: - + DrawableObject(osg::Drawable* drawable): _drawable(drawable) {} - + void apply(osg::RenderInfo& renderInfo) { _drawable->draw(renderInfo); - + if (renderInfo.getState()->checkGLErrors("Drawable")) { throw "OpenGL error"; } } - + osg::ref_ptr _drawable; }; @@ -240,20 +242,20 @@ class DrawableObject : public GLObject class GeometryTest : public GLMemoryTest { public: - + enum GLObjectType { VERTEX_ARRAY, DISPLAY_LIST, VERTEX_BUFFER_OBJECT }; - + GeometryTest(GLObjectType type, int width=64, int height=64): _glObjectType(type), _width(width), _height(height) {} - + virtual GLObject* allocate() { unsigned int numVertices = _width * _height; @@ -279,11 +281,11 @@ class GeometryTest : public GLMemoryTest quads->push_back(i + (j+1)*_width); } } - + osg::Geometry* geometry = new osg::Geometry; geometry->setVertexArray(vertices); geometry->addPrimitiveSet(quads); - + switch(_glObjectType) { case(VERTEX_ARRAY): @@ -302,10 +304,10 @@ class GeometryTest : public GLMemoryTest return new DrawableObject(geometry); } - + protected: - + GLObjectType _glObjectType; int _width; int _height; @@ -314,7 +316,7 @@ class GeometryTest : public GLMemoryTest int main( int argc, char **argv ) { osg::ArgumentParser arguments(&argc,argv); - + arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName()); arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" tests OpenGL and Windowing memory scalability.."); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","List command line options."); @@ -351,7 +353,7 @@ int main( int argc, char **argv ) ContextTests contextTests; GLMemoryTests glMemoryTests; - + int width, height, depth; while(arguments.read("--pbuffer",width,height)) { contextTests.push_back(new ContextTest(width, height, true)); } while(arguments.read("--pbuffer")) { contextTests.push_back(new ContextTest(512, 512, true)); } @@ -396,20 +398,20 @@ int main( int argc, char **argv ) return 1; } #endif - + typedef std::list< osg::ref_ptr > Contexts; typedef std::list< osg::ref_ptr > GLObjects; Contexts allocatedContexts; GLObjects glObjects; - + if (contextTests.empty()) { if (glMemoryTests.empty()) { std::cout<<"No tests specified, please specify test using the command line options below."<write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION); - return 1; + return 1; } else { @@ -421,14 +423,14 @@ int main( int argc, char **argv ) // use printf's below as C++'s ostream classes use more memory and are more likely to fail when everything // goes wrong with memory allocations. - + int numContextIterations = 0; int numGLObjectIterations = 0; int numGLObjectsApplied = 0; try { for(; numGLObjectIterationsmakeCurrent(); - + osg::RenderInfo renderInfo; renderInfo.setState(context->getState()); - + for(GLObjects::iterator gitr = glObjects.begin(); gitr != glObjects.end(); ++gitr) @@ -466,9 +468,9 @@ int main( int argc, char **argv ) (*gitr)->apply(renderInfo); ++numGLObjectsApplied; } - + context->releaseContext(); - + printf("\n\n"); fflush(stdout); } } @@ -489,7 +491,7 @@ int main( int argc, char **argv ) printf("\nSuccessful completion, contexts created = %i, gl objects applied = %i\n",numContextIterations, numGLObjectsApplied); printf("Duration = %f seconds.\n\n",osg::Timer::instance()->delta_s(startTick, endTick)); - + return 0; } diff --git a/examples/osgmovie/osgmovie.cpp b/examples/osgmovie/osgmovie.cpp index 523822ee2..9de15b188 100644 --- a/examples/osgmovie/osgmovie.cpp +++ b/examples/osgmovie/osgmovie.cpp @@ -641,7 +641,11 @@ int main(int argc, char** argv) if (wsi) { unsigned int width, height; - wsi->getScreenResolution(osg::GraphicsContext::ScreenIdentifier(0), width, height); + osg::GraphicsContext::ScreenIdentifier main_screen_id; + + main_screen_id.readDISPLAY(); + main_screen_id.setUndefinedScreenDetailsToDefaultScreen(); + wsi->getScreenResolution(main_screen_id, width, height); screenAspectRatio = float(width) / float(height); } diff --git a/examples/osgmultiviewpaging/osgmultiviewpaging.cpp b/examples/osgmultiviewpaging/osgmultiviewpaging.cpp index 73b5c3997..e7b4f0e1a 100644 --- a/examples/osgmultiviewpaging/osgmultiviewpaging.cpp +++ b/examples/osgmultiviewpaging/osgmultiviewpaging.cpp @@ -91,7 +91,11 @@ int main( int argc, char **argv ) } unsigned int width, height; - wsi->getScreenResolution(osg::GraphicsContext::ScreenIdentifier(0), width, height); + osg::GraphicsContext::ScreenIdentifier main_screen_id; + + main_screen_id.readDISPLAY(); + main_screen_id.setUndefinedScreenDetailsToDefaultScreen(); + wsi->getScreenResolution(main_screen_id, width, height); osg::ref_ptr traits = new osg::GraphicsContext::Traits; traits->x = 100; @@ -101,6 +105,8 @@ int main( int argc, char **argv ) traits->windowDecoration = true; traits->doubleBuffer = true; traits->sharedContext = 0; + traits->readDISPLAY(); + traits->setUndefinedScreenDetailsToDefaultScreen(); osg::ref_ptr gc = osg::GraphicsContext::createGraphicsContext(traits.get()); if (gc.valid()) diff --git a/examples/osgoscdevice/osgoscdevice.cpp b/examples/osgoscdevice/osgoscdevice.cpp index ea23a611b..d0d8e2972 100644 --- a/examples/osgoscdevice/osgoscdevice.cpp +++ b/examples/osgoscdevice/osgoscdevice.cpp @@ -443,6 +443,8 @@ int main( int argc, char **argv ) traits->doubleBuffer = true; traits->sharedContext = 0; traits->windowName = "Receiver / view two"; + traits->readDISPLAY(); + traits->setUndefinedScreenDetailsToDefaultScreen(); osg::ref_ptr gc = osg::GraphicsContext::createGraphicsContext(traits.get()); @@ -509,6 +511,8 @@ int main( int argc, char **argv ) traits->doubleBuffer = true; traits->sharedContext = 0; traits->windowName = "Sender / view one"; + traits->readDISPLAY(); + traits->setUndefinedScreenDetailsToDefaultScreen(); osg::ref_ptr gc = osg::GraphicsContext::createGraphicsContext(traits.get()); diff --git a/examples/osgscreencapture/osgscreencapture.cpp b/examples/osgscreencapture/osgscreencapture.cpp index be49dcb42..0169853b0 100644 --- a/examples/osgscreencapture/osgscreencapture.cpp +++ b/examples/osgscreencapture/osgscreencapture.cpp @@ -712,6 +712,8 @@ int main(int argc, char** argv) traits->pbuffer = true; traits->doubleBuffer = true; traits->sharedContext = 0; + traits->readDISPLAY(); + traits->setUndefinedScreenDetailsToDefaultScreen(); pbuffer = osg::GraphicsContext::createGraphicsContext(traits.get()); if (pbuffer.valid()) diff --git a/examples/osgsidebyside/osgsidebyside.cpp b/examples/osgsidebyside/osgsidebyside.cpp index 3117f6471..3029f985e 100644 --- a/examples/osgsidebyside/osgsidebyside.cpp +++ b/examples/osgsidebyside/osgsidebyside.cpp @@ -182,7 +182,11 @@ void singleWindowSideBySideCameras(osgViewer::Viewer& viewer) } unsigned int width, height; - wsi->getScreenResolution(osg::GraphicsContext::ScreenIdentifier(0), width, height); + osg::GraphicsContext::ScreenIdentifier main_screen_id; + + main_screen_id.readDISPLAY(); + main_screen_id.setUndefinedScreenDetailsToDefaultScreen(); + wsi->getScreenResolution(main_screen_id, width, height); @@ -198,6 +202,8 @@ void singleWindowSideBySideCameras(osgViewer::Viewer& viewer) traits->windowDecoration = true; traits->doubleBuffer = true; traits->sharedContext = 0; + traits->readDISPLAY(); + traits->setUndefinedScreenDetailsToDefaultScreen(); osg::ref_ptr gc = osg::GraphicsContext::createGraphicsContext(traits.get()); if (gc.valid()) diff --git a/examples/osgsimplegl3/osgsimplegl3.cpp b/examples/osgsimplegl3/osgsimplegl3.cpp index 6a35b1fb6..1b931be28 100644 --- a/examples/osgsimplegl3/osgsimplegl3.cpp +++ b/examples/osgsimplegl3/osgsimplegl3.cpp @@ -87,6 +87,8 @@ int main( int argc, char** argv ) traits->windowDecoration = true; traits->doubleBuffer = true; traits->glContextVersion = version; + traits->readDISPLAY(); + traits->setUndefinedScreenDetailsToDefaultScreen(); osg::ref_ptr< osg::GraphicsContext > gc = osg::GraphicsContext::createGraphicsContext( traits.get() ); if( !gc.valid() ) { diff --git a/examples/osgslice/osgslice.cpp b/examples/osgslice/osgslice.cpp index e031eeb60..cde97d1c5 100644 --- a/examples/osgslice/osgslice.cpp +++ b/examples/osgslice/osgslice.cpp @@ -142,6 +142,8 @@ int main( int argc, char **argv ) traits->doubleBuffer = true; traits->sharedContext = 0; traits->pbuffer = false; + traits->readDISPLAY(); + traits->setUndefinedScreenDetailsToDefaultScreen(); osg::ref_ptr gc = osg::GraphicsContext::createGraphicsContext(traits.get()); if (!gc || !gc->valid()) diff --git a/examples/osgtexturecompression/osgtexturecompression.cpp b/examples/osgtexturecompression/osgtexturecompression.cpp index be18a9469..7a284764b 100644 --- a/examples/osgtexturecompression/osgtexturecompression.cpp +++ b/examples/osgtexturecompression/osgtexturecompression.cpp @@ -146,7 +146,11 @@ int main(int argc, char** argv) unsigned int width, height; - wsi->getScreenResolution(osg::GraphicsContext::ScreenIdentifier(0), width, height); + osg::GraphicsContext::ScreenIdentifier main_screen_id; + + main_screen_id.readDISPLAY(); + main_screen_id.setUndefinedScreenDetailsToDefaultScreen(); + wsi->getScreenResolution(main_screen_id, width, height); osg::ref_ptr traits = new osg::GraphicsContext::Traits; traits->x = 0; @@ -155,6 +159,8 @@ int main(int argc, char** argv) traits->height = height; traits->windowDecoration = false; traits->doubleBuffer = true; + traits->readDISPLAY(); + traits->setUndefinedScreenDetailsToDefaultScreen(); osg::ref_ptr gc = osg::GraphicsContext::createGraphicsContext(traits.get()); if (!gc) diff --git a/examples/osgwindows/osgwindows.cpp b/examples/osgwindows/osgwindows.cpp index e9bf726ee..1ca9a2c80 100644 --- a/examples/osgwindows/osgwindows.cpp +++ b/examples/osgwindows/osgwindows.cpp @@ -58,6 +58,8 @@ int main( int argc, char **argv ) traits->windowDecoration = true; traits->doubleBuffer = true; traits->sharedContext = 0; + traits->readDISPLAY(); + traits->setUndefinedScreenDetailsToDefaultScreen(); osg::ref_ptr gc = osg::GraphicsContext::createGraphicsContext(traits.get()); @@ -82,6 +84,8 @@ int main( int argc, char **argv ) traits->windowDecoration = true; traits->doubleBuffer = true; traits->sharedContext = 0; + traits->readDISPLAY(); + traits->setUndefinedScreenDetailsToDefaultScreen(); osg::ref_ptr gc = osg::GraphicsContext::createGraphicsContext(traits.get());