Hi Robert,
I experienced problems using binary shaders in osgt files (=the osg-serializer
plugins). At runtime std::bad_alloc errors were thrown when using binary
shaders.
The reason is that the .osgt text files do not provide size information about
the contained binary shader hence leading to a bad allocation when reading the
shader data, probably size 0 ? The reader method in the responsible serializer
class (serializers/osg/BinaryShader) is correct and does not need to be changed
as it queries the size as expected. The writer method supports two paths(binary
output .osgb and text output .osgt/.osgx). Only the text path is affected as
the binary path writes the size.
I extended the writer in the text path by the size information. The results
before and after the fix are shown below:
Erroneous code for binary shader in osgt file before fix:
Data {
0a
0d
0
...
}
Corrected code for binary shader in osgt file after fix:
Data 524 {
0a
0d
0
...
}
After my fix the the thrown error disappeared.
Thank you!
Cheers,
Johannes
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=36482#36482
Attachments:
http://forum.openscenegraph.org//files/binaryshader_656.zip
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org