[osg-users] Error with InputStream reading osgb files

Riccardo Corsi riccardo.corsi at kairos3d.it
Mon Jun 12 04:35:21 PDT 2017


Hi Robert,

from within the BinaryStreamOperator we can get the file version with
getInputStream()->getFileVersion()
and decide to read/write the block size on 4 or 8 bytes accordingly.

For the file version check would you use > 148 (i.e. osg 3.5.6) ?
Riccardo



On Sun, Jun 11, 2017 at 2:05 PM, Robert Osfield <robert.osfield at gmail.com>
wrote:

> Good to hear you've tracked down the problem.  We might be able to
> version to use of long uints for future rev's of the OSG.
>
> On 9 June 2017 at 17:22, Riccardo Corsi <riccardo.corsi at kairos3d.it>
> wrote:
> > Hi again,
> >
> > I think I've found what's going on.
> > Basically the BinaryStreamOperator used to read the osgb format saves the
> > block size currently read with an int - see here - which is not large
> enough
> > to express very large blocks.
> >
> > I've patched the code with unsigned int (both when writing and reading
> block
> > size, always on 4 bytes) and I can now write and read correctly the files
> > that showed the problem.
> > Of course unsigned int is not large enough for arbitrarily huge blocks,
> but
> > at least it doubles the current max size.
> > I'll post a pull request with the patch.
> >
> > Using a type bigger than 4 bytes would make the current files
> unreadable, so
> > I don't think it's something that can be changed.
> > Riccardo
> >
> >
> > On Thu, Jun 8, 2017 at 1:15 PM, Riccardo Corsi <
> riccardo.corsi at kairos3d.it>
> > wrote:
> >>
> >> Hi all,
> >>
> >> I'm getting an error when reading some (pretty big) osgb files and
> having
> >> hard time in finding what's causing the issue.
> >>
> >> I'm creating the files myself with osgDB::writeNodeFile, without any
> error
> >> message when writing them.
> >> The files' contents are only Groups and Geometries with basic data
> >> (vertices, normals, stateset).
> >> The files are created and read with the same osg libraries, version
> 3.5.3.
> >> The error message I receive on the console (even at DEBUG level) is
> only:
> >>
> >> Error reading file sample.osgb: read error (InputStream: Failed to read
> >> from stream. At osg::Group )
> >>
> >> with no additional details, as it normally happens when file is not well
> >> formatted.
> >>
> >> Additional info:
> >> - I've spotted the issue for big file (2GB or more), but not always
> from a
> >> given size up. I have some 4GB files working and some 3GB causing the
> error.
> >> - in some cases, if I create foo.osgb and bar.osgb they are both loaded
> >> correctly, but if I create foo+bar.osgb (writing works ok) I get the
> error
> >> when reading it.
> >>
> >> Unfortunately I cannot share example files.
> >> I'm looking for some pointers on how to investigate further to find the
> >> culprit.
> >>
> >> My configuration is:
> >> - osg 3.5.3
> >> - windows 10
> >> - visual studio 2013
> >>
> >> Thank you,
> >> Riccardo
> >>
> >>
> >
> >
> > _______________________________________________
> > osg-users mailing list
> > osg-users at lists.openscenegraph.org
> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-
> openscenegraph.org
> >
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20170612/baabdc5b/attachment-0002.htm>


More information about the osg-users mailing list