osg2/osgt serializer issues
I've been trying to follow the serialization guide http://trac.openscenegraph.org/projects/osg//wiki/Support/KnowledgeBase/SerializationSupport and have been having a few issues.
I'm using OSG 3.4.0 built on Visual Studio 2015 64-bit. I've been testing with the cow.osg model.
This export doesn't seem to work. The output is equivalent to the .osgb export.
osgDB::ReaderWriter* rw = osgDB::Registry::instance()->getReaderWriterForExtension("osgt");
if (rw)
{
rw->writeNode(*node, ostream, new osgDB::Options("Ascii"));
}
This works
osgDB::writeNodeFile(*node, "cow.osgt");
This also works
osgconv cow.osg cow.osgt
However, both .osgt files have buggy indentation.
The ReaderWriterOSG2.cpp checks against osgDB::Options::getPluginStringata("fileType") so to select the ascii variant the following would be appropriate.
osgDB::Options* options = new osgDB::Options; options->setPluginStringData("fileType", "Ascii");
It looks like code might also support using, osgDB::Options("fileType=Ascii")) but don't recall testing this approach. We are talking usage cases that aren't used too often.
What do you mean buggy indentation? Indentation is purely cosmetic in the .osg* formats.
osgDB::Options* options = new osgDB::Options;
options->setPluginStringData("fileType", "Ascii");
This works great! Thanks. Perhaps update the guide?
About the indentation - sample results of osgconv cow.osg cow.osgt. Some lines are indented, some are not
#Ascii Scene
#Version 130
#Generator OpenSceneGraph 3.4.0
osg::Group {
UniqueID 1
Name "cow.osg"
DataVariance STATIC
Children 1 {
osg::Geode {
UniqueID 2
Name "cow.osg"
DataVariance DYNAMIC
Drawables 1 {
osg::Geometry {
UniqueID 3
DataVariance DYNAMIC
StateSet TRUE {
osg::StateSet {
UniqueID 4
DataVariance STATIC
ModeList 2 {
GL_CULL_FACE OFF
GL_LIGHTING ON
}
...
}
}
}
}
}
}
}
}
Update "the guide", there are lots of OSG resources, could you be specific, i.e url?
I haven't see indentation issues like you describe before. Curious. It might be worth you trying out the OSG-3.4 branch or OSG master as both have lots of fixes over 3.4.0.
As a general note, for support issues the official avenue is the OSG mailing list/forum, the github Issues actively viewed by many in the community.
http://trac.openscenegraph.org/projects/osg//wiki/Support/KnowledgeBase/SerializationSupport
Thanks again
That's the old website we've kept around in case we missed parts when moving it across to the new website. This was all done a number of years back so it's time we just removed the old website.
I've checked the new website and the same content was wrong as well so I've updated this.