As you can see from my giant messy stack trace below, the osg loader
is going into code in src/OpenSceneGraph/src/osg/Shader.cpp, and it's
getting there through the code in
src/osgWrappers/deprecated-dotosg/osg/. Does this mean the part of
the .osg loader that is supposed to use osgDB::readShaderFile() just
hasn't been written yet? Unfortunately, there are too many options
here for me to know how the .osg loader is supposed to work. Can
someone enlighten me? For starters, is the intention to improve the
loader so that it no longer uses all this deprecated code? Is there a
good example of a current loader that loads shaders with the proper
code paths?
Also, Robert, it would be good to know if you plan to keep the changes
I've already submitted. If not, then there's no point in trying to
fix this shader loading issue.
#0 osg::Shader::loadShaderSourceFromFile (this=0x80aaec8,
fileName="flat.zip/fossil.vs") at
/usr/local/src/OpenSceneGraph/src/osg/Shader.cpp:298
#1 0x015360c3 in Shader_readLocalData (obj=..., fr=...) at
/usr/local/src/OpenSceneGraph/src/osgWrappers/deprecated-dotosg/osg/Shader.cpp:50
#2 0x0091823e in osgDB::DeprecatedDotOsgWrapperManager::readObject
(this=0x807eeb8, dowMap=std::map with 182 elements = {...}, fr=...) at
/usr/local/src/OpenSceneGraph/src/osgDB/DotOsgWrapper.cpp:451
#3 0x009184fc in osgDB::DeprecatedDotOsgWrapperManager::readObject
(this=0x807eeb8, fr=...) at
/usr/local/src/OpenSceneGraph/src/osgDB/DotOsgWrapper.cpp:484
#4 0x009351af in osgDB::Input::readObject (this=0xbfffe578) at
/usr/local/src/OpenSceneGraph/src/osgDB/Input.cpp:57
#5 0x01585d37 in Program_readLocalData (obj=..., fr=...) at
/usr/local/src/OpenSceneGraph/src/osgWrappers/deprecated-dotosg/osg/Program.cpp:94
#6 0x0091823e in osgDB::DeprecatedDotOsgWrapperManager::readObject
(this=0x807eeb8, dowMap=std::map with 78 elements = {...}, fr=...) at
/usr/local/src/OpenSceneGraph/src/osgDB/DotOsgWrapper.cpp:451
#7 0x009189fb in
osgDB::DeprecatedDotOsgWrapperManager::readStateAttribute
(this=0x807eeb8, fr=...) at
/usr/local/src/OpenSceneGraph/src/osgDB/DotOsgWrapper.cpp:557
#8 0x00935263 in osgDB::Input::readStateAttribute (this=0xbfffe578)
at /usr/local/src/OpenSceneGraph/src/osgDB/Input.cpp:73
#9 0x0157d7a9 in StateSet_readLocalData (obj=..., fr=...) at
/usr/local/src/OpenSceneGraph/src/osgWrappers/deprecated-dotosg/osg/StateSet.cpp:449
#10 0x009178ef in
osgDB::DeprecatedDotOsgWrapperManager::readObjectOfType
(this=0x807eeb8, btw=..., fr=...) at
/usr/local/src/OpenSceneGraph/src/osgDB/DotOsgWrapper.cpp:330
#11 0x00916dcc in
osgDB::DeprecatedDotOsgWrapperManager::readObjectOfType
(this=0x807eeb8, compObj=..., fr=...) at
/usr/local/src/OpenSceneGraph/src/osgDB/DotOsgWrapper.cpp:192
#12 0x00935132 in osgDB::Input::readObjectOfType (this=0xbfffe578,
compObj=...) at /usr/local/src/OpenSceneGraph/src/osgDB/Input.cpp:47
#13 0x0159cad0 in Drawable_readLocalData (obj=..., fr=...) at
/usr/local/src/OpenSceneGraph/src/osgWrappers/deprecated-dotosg/osg/Drawable.cpp:31
#14 0x0091823e in osgDB::DeprecatedDotOsgWrapperManager::readObject
(this=0x807eeb8, dowMap=std::map with 4 elements = {...}, fr=...) at
/usr/local/src/OpenSceneGraph/src/osgDB/DotOsgWrapper.cpp:451
#15 0x00918833 in osgDB::DeprecatedDotOsgWrapperManager::readDrawable
(this=0x807eeb8, fr=...) at
/usr/local/src/OpenSceneGraph/src/osgDB/DotOsgWrapper.cpp:531
#16 0x00935227 in osgDB::Input::readDrawable (this=0xbfffe578) at
/usr/local/src/OpenSceneGraph/src/osgDB/Input.cpp:68
#17 0x0159c590 in Geode_readLocalData (obj=..., fr=...) at
/usr/local/src/OpenSceneGraph/src/osgWrappers/deprecated-dotosg/osg/Geode.cpp:40
#18 0x0091823e in osgDB::DeprecatedDotOsgWrapperManager::readObject
(this=0x807eeb8, dowMap=std::map with 182 elements = {...}, fr=...) at
/usr/local/src/OpenSceneGraph/src/osgDB/DotOsgWrapper.cpp:451
#19 0x009184fc in osgDB::DeprecatedDotOsgWrapperManager::readObject
(this=0x807eeb8, fr=...) at
/usr/local/src/OpenSceneGraph/src/osgDB/DotOsgWrapper.cpp:484
#20 0x009351af in osgDB::Input::readObject (this=0xbfffe578) at
/usr/local/src/OpenSceneGraph/src/osgDB/Input.cpp:57
#21 0x01480a41 in OSGReaderWriter::readObject (this=0x8094f30,
fin=..., options=0x8095b18) at
/usr/local/src/OpenSceneGraph/src/osgPlugins/osg/ReaderWriterOSG.cpp:199
#22 0x01447557 in ZipArchive::readObject (this=0x80914c0,
file="fossil_01.osg", options=0x80912a0) at
/usr/local/src/OpenSceneGraph/src/osgPlugins/zip/ZipArchive.cpp:191
#23 0x0094bc5c in osgDB::Registry::read (this=0x8074b38,
readFunctor=...) at
/usr/local/src/OpenSceneGraph/src/osgDB/Registry.cpp:1123
#24 0x0094ccb1 in osgDB::Registry::readImplementation (this=0x8074b38,
readFunctor=..., cacheHint=osgDB::Options::CACHE_NODES) at
/usr/local/src/OpenSceneGraph/src/osgDB/Registry.cpp:1310
#25 0x0094de3c in osgDB::Registry::readNodeImplementation
(this=0x8074b38, fileName="fossil_01.osg", options=0x0) at
/usr/local/src/OpenSceneGraph/src/osgDB/Registry.cpp:1504
#26 0x00907b52 in osgDB::Registry::readNode (this=0x8074b38,
fileName="fossil_01.osg", options=0x0, buildKdTreeIfRequired=true) at
/usr/local/src/OpenSceneGraph/include/osgDB/Registry:248
#27 0x00941a12 in osgDB::readNodeFile (filename="fossil_01.osg",
options=0x0) at
/usr/local/src/OpenSceneGraph/src/osgDB/ReadFile.cpp:69
#28 0x009428ee in osgDB::readNodeFiles (arguments=..., options=0x0) at
/usr/local/src/OpenSceneGraph/src/osgDB/ReadFile.cpp:218
#29 0x0804febb in osgDB::readNodeFiles (parser=...) at
/usr/local/src/OpenSceneGraph/include/osgDB/ReadFile:133
#30 0x0804f1e5 in main (argc=2, argv=0xbffff134) at
/usr/local/src/OpenSceneGraph/applications/osgviewer/osgviewer.cpp:139
>
> Hi Terry,
>
>> The big piece I haven't figure out yet is shaders. Shader files are
>> currently loaded in Shader::loadShaderSourceFromFile(). To load them
>> from archives I think the whole shader loading infrastructure would
>> need to be converted to work just like loading any other file.
>
> It already is. Have a look at osgDB::readShaderFile().
>
> This is more convenient because it creates the shader with the proper
> type from scratch, whereas when using Shader::loadShaderSourceFromFile()
> you need to have created a new Shader(osg::Shader::FRAGMENT or
> osg::Shader::VERTEX or ...) beforehand.
>
> So your changes will probably work correctly out of the box... :-)
>
> J-S
> --
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org