From 5f1a5f0c41322d1b3b635d5b9380a761bb517947 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 7 Oct 2002 10:02:47 +0000 Subject: [PATCH] Added code to Viewer::addViewport(..) to force the sharing of a single osg::State object between viewports. --- src/osgGLUT/Viewer.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/osgGLUT/Viewer.cpp b/src/osgGLUT/Viewer.cpp index 5c166379e..702edab4e 100644 --- a/src/osgGLUT/Viewer.cpp +++ b/src/osgGLUT/Viewer.cpp @@ -1468,9 +1468,18 @@ unsigned int Viewer::addViewport(osgUtil::SceneView* sv, def.viewport[2] = width; def.viewport[3] = height; + if (!_viewportList.empty()) + { + // force all the viewports to share the same state object as + // they all share the same graphics context. + osg::State* state = _viewportList.front().sceneView->getState(); + def.sceneView->setState(state); + } + unsigned int pos = _viewportList.size(); _viewportList.push_back(def); + return pos; }