Hi Torben,

2010/2/12 Torben Dannhauer <[email protected]>:
> My idea was something like a pointer to a buffer and size information how 
> long the content is.
> This way I could read my serialized objects and pass the data to the cluster 
> engine.

Yes, you may use writeNode() and readNode() to work with streams. Just
find the correct ReaderWriter first:
osgDB::ReaderWriter* rw =
osgDB::Registry::instance()->getReaderWriterForExtension("osgb");
if ( rw )
{
    osgDB::ReaderWriter::WriteResult wr = rw->writeNode( *scene, ostream );
    ...
    osgDB::ReaderWriter::ReadResult rr = rw->readNode( istream );
}

> How can I retireve the serialized data? Is it binary or a "large" ascii 
> string? (because source and target of the compressor are std::string)

By default it writes binary data to std::ostream. To receive an ascii
one, add "Ascii" as the option string.

> Additionally I have a question regarding compressors. In the wiki page is 
> noted, that zLib compressor is available. I found it in the source code, but 
> how can I apply the compressor to the stream to get a smaller stream?
> I'm not sure to use it, but its an interesting option with that compressor..

# ./osgconv cow.osg cow.osgb -O Compressor=zlib
# ./osgviewer cow.osgb

That is, to add "Compressor=zlib" to the option string.

You may also write user-defined compressors yourself.

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

Reply via email to