1

I've compiled OpenSceneGraph 3.4.0 on Linux (32-bit) setting OFF DYNAMIC_OPENSCENEGRAPH and DYNAMIC_OPENTHREADS flags and enabling apps and examples on CMake.

Build was successful and I have static libraries and also the example osgstaticviewer working correctly.

Then I have tried compiling osgconv using only static libraries using a CMakeLists.txt copied from osgstaticviewer and modified adding obj support and osgconv original source files. Compilation works and resulting executable works but I'm not able to convert an obj file to an osg file. In particular, if I try the command:

./osgconv myModel.obj myModel.osg

I obtain the following warning:

Warning: Could not find plugin to read objects from file "myModel.obj".
Error no data loaded.

What's the procedure for linking statically osg plugins?

Below the CMakeLists.txt used to compile osgconv:

#this file is automatically generated 

SET(TARGET_ADDED_LIBRARIES osgdb_obj osgdb_ive osgdb_openflight osgdb_osg osgdb_rgb osgdb_osg )
SET(TARGET_ADDED_LIBRARIES ${TARGET_ADDED_LIBRARIES}
    osgdb_deprecated_osg osgdb_deprecated_osgparticle osgdb_deprecated_osganimation
    osgdb_deprecated_osgfx osgdb_deprecated_osgsim osgdb_deprecated_osgtext
    osgdb_deprecated_osgviewer osgdb_deprecated_osgshadow osgdb_deprecated_osgterrain
    osgdb_deprecated_osgvolume osgdb_deprecated_osgwidget
)
SET(TARGET_ADDED_LIBRARIES ${TARGET_ADDED_LIBRARIES}
    osgdb_serializers_osg osgdb_serializers_osgparticle osgdb_serializers_osgtext
    osgdb_serializers_osgterrain osgdb_serializers_osganimation osgdb_serializers_osgfx
    osgdb_serializers_osgshadow osgdb_serializers_osgmanipulator osgdb_serializers_osgsim
    osgdb_serializers_osgvolume
)

IF(FREETYPE_FOUND)
    ADD_DEFINITIONS(-DUSE_FREETYPE)
    SET(TARGET_ADDED_LIBRARIES ${TARGET_ADDED_LIBRARIES} osgdb_freetype)
ENDIF(FREETYPE_FOUND)

SET(TARGET_SRC
    OrientationConverter.cpp 
    osgconv.cpp
)
SET(TARGET_H
    OrientationConverter.h
)

SETUP_APPLICATION(osgconv)
Francesco Argese
  • 626
  • 4
  • 11

1 Answers1

1

You need to modify the source of osgconv to have the USE_OSGPLUGIN macro seen binding support for various plugins here: http://trac.openscenegraph.org/projects/osg//browser/OpenSceneGraph/trunk/examples/osgstaticviewer/osgstaticviewer.cpp#L40

XenonofArcticus
  • 472
  • 2
  • 6
  • Solved adding USE_OSGPLUGIN macros but also the other required macros inside osgstaticviewer.cpp (USE_DOTOSGWRAPPER_LIBRARY and USE_SERIALIZE_WRAPPER_LIBRARY). Adding only USE_OSGPLUGIN it gives me a result with 0 byte. – Francesco Argese May 02 '16 at 08:37