[osg-users] Error with InputStream reading osgb files
Riccardo Corsi
riccardo.corsi at kairos3d.it
Fri Jun 9 09:22:15 PDT 2017
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
<https://github.com/openscenegraph/OpenSceneGraph/blob/master/src/osgPlugins/osg/BinaryStreamOperator.h#L282>
-
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
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20170609/a9bc90b3/attachment-0002.htm>
More information about the osg-users
mailing list