diff --git a/include/osg/CullSettings b/include/osg/CullSettings index 63a509043..95bf9f108 100644 --- a/include/osg/CullSettings +++ b/include/osg/CullSettings @@ -70,6 +70,7 @@ class OSG_EXPORT CullSettings CULL_MASK = 0x0400, CULL_MASK_LEFT = 0x0800, CULL_MASK_RIGHT = 0x1000, + CLEAR_COLOR = 0x2000, NO_VARIABLES = 0x0000, ALL_VARIABLES = 0xFFFF diff --git a/src/osgUtil/CullVisitor.cpp b/src/osgUtil/CullVisitor.cpp index 1555523fc..666d51aea 100644 --- a/src/osgUtil/CullVisitor.cpp +++ b/src/osgUtil/CullVisitor.cpp @@ -1151,7 +1151,14 @@ void CullVisitor::apply(osg::CameraNode& camera) // set up the background color and clear mask. - rtts->setClearColor(camera.getClearColor()); + if (camera.getInheritanceMask() & CLEAR_COLOR) + { + rtts->setClearColor(camera.getClearColor()); + } + else + { + rtts->setClearColor(previous_stage->getClearColor()); + } rtts->setClearMask(camera.getClearMask()); // set the color mask.