我在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)
解決增加USE_OSGPLUGIN宏也有其他所需的宏內部osgstaticviewer.cpp(USE_DOTOSGWRAPPER_LIBRARY和USE_SERIALIZE_WRAPPER_LIBRARY)。只添加USE_OSGPLUGIN,它給了我一個0字節的結果。 –