Show
Ignore:
Timestamp:
07/21/08 23:00:57 (6 years ago)
Author:
robert
Message:

Further work on osg::ImageSequence?/osgDB::ImagePager?

Files:
1 modified

Legend:

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

    r8642 r8647  
    3232 
    3333// 
    34 // A simple demo demonstrating different texturing modes,  
    35 // including using of texture extensions. 
     34// A simple demo demonstrating how to set on an animated texture using an osg::ImageSequence 
    3635// 
    37  
    38 struct ImageUpdateCallback : public osg::StateAttribute::Callback 
    39 { 
    40     /** do customized update code.*/ 
    41     virtual void operator () (osg::StateAttribute* attr, osg::NodeVisitor* nv) 
    42     { 
    43         const osg::FrameStamp* fs = nv!=0 ? nv->getFrameStamp() : 0; 
    44         osg::Texture2D* texture2D = dynamic_cast<osg::Texture2D*>(attr); 
    45         if (texture2D && texture2D->getImage() && fs) 
    46         { 
    47             texture2D->getImage()->update(fs); 
    48         } 
    49     } 
    50 }; 
    5136 
    5237osg::StateSet* createState() 
     
    5944 
    6045    osg::ref_ptr<osg::ImageSequence> imageSequence = new osg::ImageSequence; 
    61     imageSequence->addImage(image_0.get(), 0.25); 
    62     imageSequence->addImage(image_1.get(), 0.25); 
    63     imageSequence->addImage(image_2.get(), 0.25); 
    64     imageSequence->addImage(image_3.get(), 0.25); 
    65  
     46    imageSequence->addImage(image_0.get()); 
     47    imageSequence->addImage(image_1.get()); 
     48    imageSequence->addImage(image_2.get()); 
     49    imageSequence->addImage(image_3.get()); 
     50     
    6651    osg::Texture2D* texture = new osg::Texture2D; 
    6752    texture->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR); 
     
    7257    //texture->setTextureSize(512,512); 
    7358     
    74     texture->setUpdateCallback(new ImageUpdateCallback); 
     59    texture->setUpdateCallback(new osg::ImageSequence::UpdateCallback); 
    7560 
    7661    // create the StateSet to store the texture data