[osg-users] Using zlib compressor on iOS

75 views
Skip to first unread message

Christian Noon

unread,
Mar 18, 2013, 12:21:08 PM3/18/13
to osg-...@lists.openscenegraph.org
Hi everyone,

Got a quick question which I'm hoping is easy. I've compressed some osg files using the osg plugin with a custom "vipre" extension using the zlib compressor with a simple app I built on Mac OS X and now I'm trying to read that file back in on iOS. I'm able to read the files in no problem if I don't compress them. If I do compress them though, I keep getting compressor errors because I haven't registered the compressor probably since everything is built as static libraries and plugins. I attached my errors as well as what I've tried for using the compressor. I have all the necessary library OSG static libraries and plugins linking as well as the libz.dylib in the iOS project. Hopefully I'm just missing something simple...

Static Plugin Logic:


Code:

// OSG headers
#include <osgDB/Registry>

// Pull in the plugins
USE_OSGPLUGIN(imageio)
USE_OSGPLUGIN(osg2)

// Pull in the zlib compressor (None of these three compile)
USE_COMPRESSOR_WRAPPER(Compressors)
USE_COMPRESSOR_WRAPPER(ZLibCompressor)
USE_COMPRESSOR_WRAPPER(zlib)

// Pull in the serializer wrapper libraries
USE_SERIALIZER_WRAPPER_LIBRARY(osg)
USE_SERIALIZER_WRAPPER_LIBRARY(osgAnimation)
USE_SERIALIZER_WRAPPER_LIBRARY(osgFX)

// Pull in the vipre serializer wrappers
USE_SERIALIZER_WRAPPER_LIBRARY(vipre)
USE_SERIALIZER_WRAPPER_LIBRARY(vipreDICOM)
USE_SERIALIZER_WRAPPER_LIBRARY(vipreOTS)





Debug output from iOS App without USE_COMPRESSOR_WRAPPER specified:


Code:

[vipre] Registering "vipre" extension with osgDB::Registry
[vipre] Reading object file: /var/mobile/Applications/01858B1D-E876-4C66-8CA5-204863C58043/BodyViz.app/Cardiac Series.vipre
FindFileInPath(/var/mobile/Applications/01858B1D-E876-4C66-8CA5-204863C58043/BodyViz.app/Cardiac Series.vipre): returning /var/mobile/Applications/01858B1D-E876-4C66-8CA5-204863C58043/BodyViz.app/Cardiac Series.vipre
Reading OpenSceneGraph binary file with the same endian as this computer.
itr='/var/mobile/Applications/01858B1D-E876-4C66-8CA5-204863C58043/BodyViz.app/PlugIns'
FindFileInPath() : trying /var/mobile/Applications/01858B1D-E876-4C66-8CA5-204863C58043/BodyViz.app/PlugIns/libzlib.so ...
itr='/var/mobile/Applications/01858B1D-E876-4C66-8CA5-204863C58043/Library/Application Support/OpenSceneGraph/PlugIns'
FindFileInPath() : trying /var/mobile/Applications/01858B1D-E876-4C66-8CA5-204863C58043/Library/Application Support/OpenSceneGraph/PlugIns/libzlib.so ...
itr='/Library/Application Support/OpenSceneGraph/PlugIns'
FindFileInPath() : trying /Library/Application Support/OpenSceneGraph/PlugIns/libzlib.so ...
itr='/Network/Library/Application Support/OpenSceneGraph/PlugIns'
FindFileInPath() : trying /Network/Library/Application Support/OpenSceneGraph/PlugIns/libzlib.so ...
Warning: dynamic library 'libzlib.so' does not exist (or isn't readable):
dlopen(//libzlib.so, 9): image not found
DynamicLibrary::failed loading "libzlib.so"
itr='/var/mobile/Applications/01858B1D-E876-4C66-8CA5-204863C58043/BodyViz.app/PlugIns'
FindFileInPath() : trying /var/mobile/Applications/01858B1D-E876-4C66-8CA5-204863C58043/BodyViz.app/PlugIns/osgPlugins-3.1.4/osgdb_compressor_zlib.so ...
itr='/var/mobile/Applications/01858B1D-E876-4C66-8CA5-204863C58043/Library/Application Support/OpenSceneGraph/PlugIns'
FindFileInPath() : trying /var/mobile/Applications/01858B1D-E876-4C66-8CA5-204863C58043/Library/Application Support/OpenSceneGraph/PlugIns/osgPlugins-3.1.4/osgdb_compressor_zlib.so ...
itr='/Library/Application Support/OpenSceneGraph/PlugIns'
FindFileInPath() : trying /Library/Application Support/OpenSceneGraph/PlugIns/osgPlugins-3.1.4/osgdb_compressor_zlib.so ...
itr='/Network/Library/Application Support/OpenSceneGraph/PlugIns'
FindFileInPath() : trying /Network/Library/Application Support/OpenSceneGraph/PlugIns/osgPlugins-3.1.4/osgdb_compressor_zlib.so ...
itr='/var/mobile/Applications/01858B1D-E876-4C66-8CA5-204863C58043/BodyViz.app/PlugIns'
FindFileInPath() : trying /var/mobile/Applications/01858B1D-E876-4C66-8CA5-204863C58043/BodyViz.app/PlugIns/osgdb_compressor_zlib.so ...
itr='/var/mobile/Applications/01858B1D-E876-4C66-8CA5-204863C58043/Library/Application Support/OpenSceneGraph/PlugIns'
FindFileInPath() : trying /var/mobile/Applications/01858B1D-E876-4C66-8CA5-204863C58043/Library/Application Support/OpenSceneGraph/PlugIns/osgdb_compressor_zlib.so ...
itr='/Library/Application Support/OpenSceneGraph/PlugIns'
FindFileInPath() : trying /Library/Application Support/OpenSceneGraph/PlugIns/osgdb_compressor_zlib.so ...
itr='/Network/Library/Application Support/OpenSceneGraph/PlugIns'
FindFileInPath() : trying /Network/Library/Application Support/OpenSceneGraph/PlugIns/osgdb_compressor_zlib.so ...
Warning: dynamic library 'osgPlugins-3.1.4/osgdb_compressor_zlib.so' does not exist (or isn't readable):
dlopen(osgPlugins-3.1.4/osgdb_compressor_zlib.so, 9): image not found
DynamicLibrary::failed loading "osgPlugins-3.1.4/osgdb_compressor_zlib.so"
itr='/var/mobile/Applications/01858B1D-E876-4C66-8CA5-204863C58043/BodyViz.app/PlugIns'
FindFileInPath() : trying /var/mobile/Applications/01858B1D-E876-4C66-8CA5-204863C58043/BodyViz.app/PlugIns/osgPlugins-3.1.4/osgdb_zlib.so ...
itr='/var/mobile/Applications/01858B1D-E876-4C66-8CA5-204863C58043/Library/Application Support/OpenSceneGraph/PlugIns'
FindFileInPath() : trying /var/mobile/Applications/01858B1D-E876-4C66-8CA5-204863C58043/Library/Application Support/OpenSceneGraph/PlugIns/osgPlugins-3.1.4/osgdb_zlib.so ...
itr='/Library/Application Support/OpenSceneGraph/PlugIns'
FindFileInPath() : trying /Library/Application Support/OpenSceneGraph/PlugIns/osgPlugins-3.1.4/osgdb_zlib.so ...
itr='/Network/Library/Application Support/OpenSceneGraph/PlugIns'
FindFileInPath() : trying /Network/Library/Application Support/OpenSceneGraph/PlugIns/osgPlugins-3.1.4/osgdb_zlib.so ...
itr='/var/mobile/Applications/01858B1D-E876-4C66-8CA5-204863C58043/BodyViz.app/PlugIns'
FindFileInPath() : trying /var/mobile/Applications/01858B1D-E876-4C66-8CA5-204863C58043/BodyViz.app/PlugIns/osgdb_zlib.so ...
itr='/var/mobile/Applications/01858B1D-E876-4C66-8CA5-204863C58043/Library/Application Support/OpenSceneGraph/PlugIns'
FindFileInPath() : trying /var/mobile/Applications/01858B1D-E876-4C66-8CA5-204863C58043/Library/Application Support/OpenSceneGraph/PlugIns/osgdb_zlib.so ...
itr='/Library/Application Support/OpenSceneGraph/PlugIns'
FindFileInPath() : trying /Library/Application Support/OpenSceneGraph/PlugIns/osgdb_zlib.so ...
itr='/Network/Library/Application Support/OpenSceneGraph/PlugIns'
FindFileInPath() : trying /Network/Library/Application Support/OpenSceneGraph/PlugIns/osgdb_zlib.so ...
Warning: dynamic library 'osgPlugins-3.1.4/osgdb_zlib.so' does not exist (or isn't readable):
dlopen(osgPlugins-3.1.4/osgdb_zlib.so, 9): image not found
DynamicLibrary::failed loading "osgPlugins-3.1.4/osgdb_zlib.so"
InputStream::decompress(): No such compressor zlib




Thanks everyone for the help!
--

Christian
[/code]

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=53146#53146





_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Christian Noon

unread,
Mar 18, 2013, 4:32:18 PM3/18/13
to osg-...@lists.openscenegraph.org
Well now I can see why I was having problems. Looks like we've got a copy/paste error in the osgDB::Registry USE_COMPRESSOR_WRAPPER macro. It is currently this:


Code:

#define USE_COMPRESSOR_WRAPPER(classname) \
extern "C" void wrapper_serializer_##classname(void); \
static osgDB::PluginFunctionProxy proxy_compressor_##classname(wrapper_compressor_##classname);




And needs to be modified to this:


Code:

#define USE_COMPRESSOR_WRAPPER(classname) \
extern "C" void wrapper_compressor_##classname(void); \
static osgDB::PluginFunctionProxy proxy_compressor_##classname(wrapper_compressor_##classname);




I'm going to submit a patch for this for anyone else that has this problem.

Thanks!
--

Christian

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=53147#53147
Reply all
Reply to author
Forward
0 new messages