Skip to content
Browse files

Improved handling of setting of the depth of the UI.

git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14418 16af8721-9629-0410-8352-f15c8da7e697
  • Loading branch information...
1 parent d6ec5da commit 1c09487508f9c631de093446f835b7c66bf3b829 Robert OSFIELD committed
Showing with 16 additions and 4 deletions.
  1. +1 −0 include/osgUI/Style
  2. +5 −2 src/osgUI/Popup.cpp
  3. +10 −2 src/osgUI/Style.cpp
View
1 include/osgUI/Style
@@ -52,6 +52,7 @@ public:
virtual osg::Node* createText(const osg::BoundingBox& extents, const AlignmentSettings* as, const TextSettings* textSettings, const std::string& text);
virtual osg::Node* createIcon(const osg::BoundingBox& extents, const std::string& filename, const osg::Vec4& colour);
virtual void setupDialogStateSet(osg::StateSet* stateset, int binNum);
+ virtual void setupPopupStateSet(osg::StateSet* stateset, int binNum);
virtual void setupClipStateSet(const osg::BoundingBox& extents, osg::StateSet* stateset);
protected:
View
7 src/osgUI/Popup.cpp
@@ -76,8 +76,11 @@ void Popup::createGraphicsImplementation()
bool requiresFrame = (getFrameSettings() && getFrameSettings()->getShape()!=osgUI::FrameSettings::NO_FRAME);
if (requiresFrame) { _transform->addChild(style->createFrame(_extents, getFrameSettings(), dialogBackgroundColor)); }
-
- style->setupDialogStateSet(getOrCreateStateSet(), 6);
+#if 1
+ style->setupDialogStateSet(getOrCreateStateSet(),6);
+#else
+ style->setupPopupStateSet(getOrCreateStateSet(),6);
+#endif
style->setupClipStateSet(_extents, getOrCreateStateSet());
View
12 src/osgUI/Style.cpp
@@ -387,6 +387,7 @@ osg::Node* Style::createPanel(const osg::BoundingBox& extents, const osg::Vec4&
return geometry.release();
}
+
osg::Node* Style::createDepthSetPanel(const osg::BoundingBox& extents)
{
// OSG_NOTICE<<"createDepthSetPanel"<<std::endl;
@@ -405,12 +406,15 @@ osg::Node* Style::createDepthSetPanel(const osg::BoundingBox& extents)
geometry->addPrimitiveSet( new osg::DrawArrays(GL_TRIANGLE_STRIP, 0, 4) );
osg::ref_ptr<osg::StateSet> stateset = geometry->getOrCreateStateSet();
- stateset->setAttributeAndModes( _enabledDepthWrite.get(), osg::StateAttribute::ON);
- stateset->setAttributeAndModes( _disableColorWriteMask.get() );
+ stateset->setAttributeAndModes( _enabledDepthWrite.get(), osg::StateAttribute::ON | osg::StateAttribute::PROTECTED );
+ stateset->setAttributeAndModes( _disableColorWriteMask.get(), osg::StateAttribute::ON | osg::StateAttribute::PROTECTED );
+ stateset->setRenderBinDetails(20, "TraversalOrderBin", osg::StateSet::OVERRIDE_PROTECTED_RENDERBIN_DETAILS);
+ stateset->setNestRenderBins(false);
return geometry.release();
}
+
void Style::setupDialogStateSet(osg::StateSet* stateset, int binNum)
{
stateset->setRenderBinDetails(binNum, "TraversalOrderBin", osg::StateSet::OVERRIDE_PROTECTED_RENDERBIN_DETAILS);
@@ -419,6 +423,10 @@ void Style::setupDialogStateSet(osg::StateSet* stateset, int binNum)
stateset->setNestRenderBins(false);
}
+void Style::setupPopupStateSet(osg::StateSet* /*stateset*/, int /*binNum*/)
+{
+}
+
void Style::setupClipStateSet(const osg::BoundingBox& extents, osg::StateSet* stateset)
{
unsigned int clipTextureUnit = 1;

0 comments on commit 1c09487

Please sign in to comment.
Something went wrong with that request. Please try again.