diff --git a/src/Demos/hangglide/hangglide.cpp b/src/Demos/hangglide/hangglide.cpp index 7d95c4377..8bd0d5cb1 100644 --- a/src/Demos/hangglide/hangglide.cpp +++ b/src/Demos/hangglide/hangglide.cpp @@ -149,22 +149,6 @@ int main( int argc, char **argv ) osgGLUT::Viewer viewer; viewer.addViewport( rootnode ); - - osg::StateSet* stateset = rootnode->getStateSet(); - if (stateset==NULL) - { - stateset = new osg::StateSet; - rootnode->setStateSet(stateset); - } - - // set up depth to be inherited by the rest of the scene unless - // overrideen. - osg::Depth* rootDepth = new osg::Depth; - rootDepth->setFunction(osg::Depth::LESS); - rootDepth->setRange(0.0,1.0); - - stateset->setAttributeAndModes(rootDepth, osg::StateAttribute::ON ); - unsigned int pos = viewer.registerCameraManipulator(new GliderManipulator()); // Open window so camera manipulator's warp pointer request will succeed diff --git a/src/osg/StateSet.cpp b/src/osg/StateSet.cpp index 14fa1c070..4531cf998 100644 --- a/src/osg/StateSet.cpp +++ b/src/osg/StateSet.cpp @@ -10,6 +10,7 @@ #include #include #include +#include using namespace osg; @@ -56,6 +57,8 @@ void StateSet::setGlobalDefaults() setAttributeAndModes(new PolygonMode,StateAttribute::OFF); setAttributeAndModes(new Transparency,StateAttribute::OFF); + + setAttributeAndModes(new Depth,StateAttribute::ON); }