Show
Ignore:
Timestamp:
04/22/05 17:44:21 (10 years ago)
Author:
robert
Message:

Improved handling of unsupported formats

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/examples/osgmovie/osgmovie.cpp

    r3856 r4082  
    243243    } 
    244244 
    245     osg::Geode* geode = new osg::Geode; 
     245    osg::ref_ptr<osg::Geode> geode = new osg::Geode; 
    246246    osg::Vec3 pos(0.0f,0.0f,0.0f); 
    247247     
     
    253253            osg::ImageStream* imagestream = dynamic_cast<osg::ImageStream*>(image); 
    254254            if (imagestream) imagestream->play(); 
    255             geode->addDrawable(createTexturedQuadGeometry(pos,image->s(),image->t(),image)); 
    256             geode->getOrCreateStateSet()->setMode(GL_LIGHTING,osg::StateAttribute::OFF); 
    257255             
    258             pos.z() += image->t()*1.5f; 
    259         } 
    260  
     256            if (image) 
     257            { 
     258                geode->addDrawable(createTexturedQuadGeometry(pos,image->s(),image->t(),image)); 
     259                geode->getOrCreateStateSet()->setMode(GL_LIGHTING,osg::StateAttribute::OFF); 
     260 
     261                pos.z() += image->t()*1.5f; 
     262            } 
     263            else 
     264            { 
     265                std::cout<<"Unable to read file "<<arguments[i]<<std::endl; 
     266            }             
     267        } 
     268    } 
     269     
     270    if (geode->getNumDrawables()==0) 
     271    { 
     272        // nothing loaded. 
     273        return 1; 
    261274    } 
    262275 
    263276    // pass the model to the MovieEventHandler so it can pick out ImageStream's to manipulate. 
    264     meh->set(geode); 
     277    meh->set(geode.get()); 
    265278 
    266279    // report any errors if they have occured when parsing the program aguments. 
     
    295308 
    296309    // set the scene to render 
    297     viewer.setSceneData(geode); 
     310    viewer.setSceneData(geode.get()); 
    298311 
    299312    // create the windows and run the threads.