在Linux上静态编译osgconv并支持obj文件
问题描述:
我在Linux(32位)上编译OpenSceneGraph 3.4.0,设置OFF DYNAMIC_OPENSCENEGRAPH和DYNAMIC_OPENTHREADS标志并启用CMake上的应用程序和示例。在Linux上静态编译osgconv并支持obj文件
构建成功,我有静态库,也是例子osgstaticviewer正常工作。
然后我试图编译osgconv使用利用osgstaticviewer抄的CMakeLists.txt只有静态库和修改添加OBJ支持和osgconv原始的源文件。编译工作和生成的可执行文件,但我无法将obj文件转换为osg文件。特别是,如果我尝试的命令:
./osgconv myModel.obj myModel.osg
我得到以下警告:
Warning: Could not find plugin to read objects from file "myModel.obj".
Error no data loaded.
什么是用于连接静态OSG插件程序?
下方的CMakeLists.txt用来编译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)
答
您需要修改osgconv源已经看到约束力的各种插件这里支持USE_OSGPLUGIN宏: http://trac.openscenegraph.org/projects/osg//browser/OpenSceneGraph/trunk/examples/osgstaticviewer/osgstaticviewer.cpp#L40
解决增加USE_OSGPLUGIN宏也有其他所需的宏内部osgstaticviewer.cpp(USE_DOTOSGWRAPPER_LIBRARY和USE_SERIALIZE_WRAPPER_LIBRARY)。只添加USE_OSGPLUGIN,它给了我一个0字节的结果。 –