diff --git a/examples/osghud/osghud.cpp b/examples/osghud/osghud.cpp index 9e3f8d985..d98ca8b6e 100644 --- a/examples/osghud/osghud.cpp +++ b/examples/osghud/osghud.cpp @@ -201,14 +201,10 @@ int main( int argc, char **argv ) // read the scene from the list of file specified commandline args. osg::ref_ptr scene = osgDB::readNodeFiles(arguments); - osg::ref_ptr group = dynamic_cast(scene.get()); - if (!group) - { - group = new osg::Group; - group->addChild(scene.get()); - } - + osg::ref_ptr group = new osg::Group; + // add the HUD subgraph. + if (scene.valid()) group->addChild(scene.get()); group->addChild(createHUD()); // set the scene to render