From 505db98c47b803ed90c267eb4c4785110f969c99 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 22 Apr 2005 15:44:21 +0000 Subject: [PATCH] Improved handling of unsupported formats --- examples/osgmovie/osgmovie.cpp | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/examples/osgmovie/osgmovie.cpp b/examples/osgmovie/osgmovie.cpp index f90994e35..917bf48e8 100644 --- a/examples/osgmovie/osgmovie.cpp +++ b/examples/osgmovie/osgmovie.cpp @@ -242,7 +242,7 @@ int main(int argc, char** argv) return 1; } - osg::Geode* geode = new osg::Geode; + osg::ref_ptr geode = new osg::Geode; osg::Vec3 pos(0.0f,0.0f,0.0f); for(int i=1;i(image); if (imagestream) imagestream->play(); - geode->addDrawable(createTexturedQuadGeometry(pos,image->s(),image->t(),image)); - geode->getOrCreateStateSet()->setMode(GL_LIGHTING,osg::StateAttribute::OFF); - pos.z() += image->t()*1.5f; - } + if (image) + { + geode->addDrawable(createTexturedQuadGeometry(pos,image->s(),image->t(),image)); + geode->getOrCreateStateSet()->setMode(GL_LIGHTING,osg::StateAttribute::OFF); + pos.z() += image->t()*1.5f; + } + else + { + std::cout<<"Unable to read file "<getNumDrawables()==0) + { + // nothing loaded. + return 1; } // pass the model to the MovieEventHandler so it can pick out ImageStream's to manipulate. - meh->set(geode); + meh->set(geode.get()); // report any errors if they have occured when parsing the program aguments. if (arguments.errors()) @@ -294,7 +307,7 @@ int main(int argc, char** argv) } // set the scene to render - viewer.setSceneData(geode); + viewer.setSceneData(geode.get()); // create the windows and run the threads. viewer.realize();