+ assert(dynamic_cast<osg::Hint*>(stateAttribute));
+ osg::Hint* hint = static_cast<osg::Hint*>(stateAttribute);
+
+ const char* value = mConfigNode->getStringValue();
+ if (!value)
+ hint->setMode(GL_DONT_CARE);
+ else if (0 == strcmp(value, "nicest"))
+ hint->setMode(GL_NICEST);
+ else if (0 == strcmp(value, "fastest"))
+ hint->setMode(GL_FASTEST);
+ else
+ hint->setMode(GL_DONT_CARE);
+ }
+private:
+ SGSharedPtr<SGPropertyNode> mConfigNode;
+};
+
+
+class SGPuDrawable : public osg::Drawable {
+public:
+ SGPuDrawable()
+ {
+ // Dynamic stuff, do not store geometry
+ setUseDisplayList(false);
+
+ osg::StateSet* stateSet = getOrCreateStateSet();
+ stateSet->setRenderBinDetails(1001, "RenderBin");
+ // speed optimization?
+ stateSet->setMode(GL_CULL_FACE, osg::StateAttribute::OFF);
+ // We can do translucent menus, so why not. :-)
+ stateSet->setAttribute(new osg::BlendFunc(osg::BlendFunc::SRC_ALPHA, osg::BlendFunc::ONE_MINUS_SRC_ALPHA));
+ stateSet->setMode(GL_BLEND, osg::StateAttribute::ON);
+ stateSet->setTextureMode(0, GL_TEXTURE_2D, osg::StateAttribute::OFF);
+
+ stateSet->setTextureAttribute(0, new osg::TexEnv(osg::TexEnv::MODULATE));
+
+ stateSet->setMode(GL_FOG, osg::StateAttribute::OFF);
+ stateSet->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF);
+ }
+ virtual void drawImplementation(osg::RenderInfo& renderInfo) const
+ { drawImplementation(*renderInfo.getState()); }
+ void drawImplementation(osg::State& state) const
+ {
+ state.setActiveTextureUnit(0);
+ state.setClientActiveTextureUnit(0);
+
+ state.disableAllVertexArrays();
+
+ glPushAttrib(GL_ALL_ATTRIB_BITS);
+ glPushClientAttrib(~0u);
+
+ puDisplay();
+
+ glPopClientAttrib();
+ glPopAttrib();
+ }
+
+ virtual osg::Object* cloneType() const { return new SGPuDrawable; }
+ virtual osg::Object* clone(const osg::CopyOp&) const { return new SGPuDrawable; }
+
+private:
+};
+
+class SGHUDAndPanelDrawable : public osg::Drawable {
+public:
+ SGHUDAndPanelDrawable()
+ {
+ // Dynamic stuff, do not store geometry
+ setUseDisplayList(false);
+
+ osg::StateSet* stateSet = getOrCreateStateSet();
+ stateSet->setRenderBinDetails(1000, "RenderBin");
+
+ // speed optimization?
+ stateSet->setMode(GL_CULL_FACE, osg::StateAttribute::OFF);
+ stateSet->setAttribute(new osg::BlendFunc(osg::BlendFunc::SRC_ALPHA, osg::BlendFunc::ONE_MINUS_SRC_ALPHA));
+ stateSet->setMode(GL_BLEND, osg::StateAttribute::ON);
+ stateSet->setMode(GL_FOG, osg::StateAttribute::OFF);
+ stateSet->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF);
+
+ stateSet->setTextureAttribute(0, new osg::TexEnv(osg::TexEnv::MODULATE));
+ }
+ virtual void drawImplementation(osg::RenderInfo& renderInfo) const
+ { drawImplementation(*renderInfo.getState()); }
+ void drawImplementation(osg::State& state) const
+ {
+ state.setActiveTextureUnit(0);
+ state.setClientActiveTextureUnit(0);
+ state.disableAllVertexArrays();
+
+ glPushAttrib(GL_ALL_ATTRIB_BITS);
+ glPushClientAttrib(~0u);