Hi Miha,

I've looked into the issue and have experimented with adding your
changes, albeit with an extra version check to ensure backwards
compatibility.  I'm not yet sure whether to merge the changes though
as it'll detract from the readability of the .osgt file as you get
extra tokens that are used for 99% of OSG applications.

You mention that you sample code results in a invalid osg file, but I
believe it's valid, it's just written out as a object file rather than
a scene file so can't be read as a scene file.  To have a scene file
you have to have nodes, so have to decorate the geometry with a geode
and then write out the geode to disk via writeNodeFile().  Once I
added this to your example code below the file wrote out and read in
just fine using osgconv and osgviewer.

My guess is that you were attempting to read an object file as a full
scene graph file but the scene graph level loaders won't load it as
it's not a scene graph without nodes.

Robert.

On 16 August 2012 16:32, Miha RavÅ¡elj <[email protected]> wrote:
> I found out that writePrimitiveSet and readPrimitiveSet does not have shared
> object implementation(uniqueID) in InputStream and OutputStream. Is this by
> design or was accidentally forgotten during development?
>
> The following example produces invalid osg file:
>
> osg::ref_ptr<osg::Geometry> geometry = new osg::Geometry;
> osg::ref_ptr<osg::DrawArrays> drawArray = new
> osg::DrawArrays(GL_TRIANGLE_STRIP, 0,4);
> geometry->addPrimitiveSet(drawArray);
> geometry->addPrimitiveSet(drawArray);
>
> osgDB::writeObjectFile(*geometry,"test.osgt");
>
> Second primitiveset should be written only with uniqueID and not duplicated.
> This causes invalid state when object is read back.
>
> I have attached fixed InputStream.cpp and OutputStream.cpp which resolves
> issue described above.
>
> Miha
>
> _______________________________________________
> osg-submissions mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
>
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to