From d350ea5395906caf595e1d43b046453d38c85813 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 24 Jan 2012 17:30:44 +0000 Subject: [PATCH] Moved setEndBarrierOperation(..) implementation into .cpp and added support for stoppig and starting threading if required. --- include/osgViewer/ViewerBase | 2 +- src/osgViewer/ViewerBase.cpp | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/include/osgViewer/ViewerBase b/include/osgViewer/ViewerBase index ac7ab2a75..4f631380e 100644 --- a/include/osgViewer/ViewerBase +++ b/include/osgViewer/ViewerBase @@ -111,7 +111,7 @@ class OSGVIEWER_EXPORT ViewerBase : public virtual osg::Object * or NO_OPERATION. NO_OPERATION is the default. Per BarrierOperation::operator()(), * a glFlush() command, glFinish() command, or no additional OpenGL command will be * issued before entering the end barrier. */ - void setEndBarrierOperation(const osg::BarrierOperation::PreBlockOp& op) { _endBarrierOperation = op; } + void setEndBarrierOperation(osg::BarrierOperation::PreBlockOp op); /** Get the end barrier operation. */ osg::BarrierOperation::PreBlockOp getEndBarrierOperation() const { return _endBarrierOperation; } diff --git a/src/osgViewer/ViewerBase.cpp b/src/osgViewer/ViewerBase.cpp index 1a96ebfab..b917afb00 100644 --- a/src/osgViewer/ViewerBase.cpp +++ b/src/osgViewer/ViewerBase.cpp @@ -179,6 +179,16 @@ void ViewerBase::setEndBarrierPosition(BarrierPosition bp) if (_threadingModel!=SingleThreaded) startThreading(); } +void ViewerBase::setEndBarrierOperation(osg::BarrierOperation::PreBlockOp op) +{ + if (_endBarrierOperation == op) return; + + if (_threadsRunning) stopThreading(); + + _endBarrierOperation = op; + + if (_threadingModel!=SingleThreaded) startThreading(); +} void ViewerBase::stopThreading() {