Hello everyone,

I've discovered a problem with the Texture2D serializer that occurs when the
associated image is an instance of an osg::ImageSequence.
I think this happens because the ImageSerializer::read method calls the
InputStream::readImage without ensuring that the object is actually an
osg::Image, producing a read error.

Can someone evaluate my observations?


I use OSG-3.0.1, but in 3.1.2 ChangeLog file I have not found anything
about it.



This is the osgviewer output:

[martino@slack] osg_image_sequence $ osgviewer graph.osgt
InputStream::readObject(): Unsupported wrapper class
osg::StateAttributeCallback
Warning: Could not find plugin to read objects from file "".
AsciiInputIterator::readProperty(): Unmatched property }, expecting Value



I attach two files:

    write_graph.cpp produces graph.osgt

    graph.osgt contains the ImageSequence that osgDB::readNodeFile cannot
read




Thanks you all,
Martino
#include <osg/Geometry>
#include <osg/Geode>
#include <osg/Texture2D>
#include <osg/ImageSequence>

#include <osgDB/WriteFile>




int
main(int argc, char** argv)
{
    osg::ref_ptr<osg::Geode>    root            = NULL ;
    osg::Geometry*              geometry        = NULL ;
    osg::ImageSequence*         image_sequence  = NULL ;
    osg::Texture2D*             texture         = NULL ;



    geometry = osg::createTexturedQuadGeometry( osg::Vec3(-1,  0, -1),
                                                osg::Vec3( 2,  0,  0),
                                                osg::Vec3( 0,  0,  2)
                                              ) ;


    root = new osg::Geode() ;

    root->addDrawable( geometry ) ;




    image_sequence = new osg::ImageSequence() ;


    for(int i=1; i<argc; i++) {
        image_sequence->addImageFile( argv[i] ) ;
    }





    texture = new osg::Texture2D( image_sequence ) ;

    root->getOrCreateStateSet()->setTextureAttributeAndModes(   0, 
                                                                texture,
                                                                osg::StateAttribute::ON
                                                            ) ;



    osgDB::writeNodeFile( *root, "graph.osgt" ) ;



    return 0 ;
}

Attachment: graph.osgt
Description: Binary data

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to