From 906bb27fa0355a69dd15d41350df0070adb1aced Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 26 May 2015 17:22:05 +0000 Subject: [PATCH] From Farshid Lashkari, "attached a small change to osgUtil::SceneView that prevents unnecessary calls to glClear when the split stereo separation is 0." git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14875 16af8721-9629-0410-8352-f15c8da7e697 --- src/osgUtil/SceneView.cpp | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/osgUtil/SceneView.cpp b/src/osgUtil/SceneView.cpp index 7510d26bd..b9ab69256 100644 --- a/src/osgUtil/SceneView.cpp +++ b/src/osgUtil/SceneView.cpp @@ -1146,14 +1146,15 @@ void SceneView::draw() _renderStageRight->drawPreRenderStages(_renderInfo,previous); double separation = _displaySettings->getSplitStereoHorizontalSeparation(); + if (separation > 0.0) + { + double left_half_width = (getViewport()->width()-separation)/2.0; - double left_half_width = (getViewport()->width()-separation)/2.0; - - clearArea(static_cast(getViewport()->x()+left_half_width), - static_cast(getViewport()->y()), - static_cast(separation), - static_cast(getViewport()->height()),_renderStageLeft->getClearColor()); - + clearArea(static_cast(getViewport()->x()+left_half_width), + static_cast(getViewport()->y()), + static_cast(separation), + static_cast(getViewport()->height()),_renderStageLeft->getClearColor()); + } _localStateSet->setAttribute(_viewportLeft.get()); _renderStageLeft->draw(_renderInfo,previous); @@ -1196,14 +1197,16 @@ void SceneView::draw() _renderStageRight->drawPreRenderStages(_renderInfo,previous); double separation = _displaySettings->getSplitStereoVerticalSeparation(); + if (separation > 0.0) + { + double bottom_half_height = (getViewport()->height()-separation)/2.0; - double bottom_half_height = (getViewport()->height()-separation)/2.0; - - clearArea(static_cast(getViewport()->x()), - static_cast(getViewport()->y()+bottom_half_height), - static_cast(getViewport()->width()), - static_cast(separation), - _renderStageLeft->getClearColor()); + clearArea(static_cast(getViewport()->x()), + static_cast(getViewport()->y()+bottom_half_height), + static_cast(getViewport()->width()), + static_cast(separation), + _renderStageLeft->getClearColor()); + } _localStateSet->setAttribute(_viewportLeft.get()); _renderStageLeft->draw(_renderInfo,previous);