OpenSceneGraph没有加载openflight插件

问题描述 投票:1回答:1

我在使用简单的测试应用程序将openflight(* .flt)模型加载到Openscenegraph时遇到问题:

#include <osgDB/ReadFile>
#include <iostream>

using namespace std;

int main(int argc, char* argv[])
{
    // Setting the message level low so I can read Debug messages
    osg::setNotifyLevel(osg::NotifySeverity::DEBUG_FP);

    cout << "Opening flt file..." << endl;
    osg::ref_ptr<osg::Node> mdl = osgDB::readNodeFile(argv[1]);
    if (mdl != NULL) cout << "Opening flt file successful" << endl;
    else cout << "Opening flt file failed" << endl;

    return 0;
}

这应该通过将文件作为参数传递给应用程序来读取文件pyramid.flt,它位于我的可执行文件目录中。但是,OSG似乎无法加载所需的Openflight插件来确实读取该文件。因此程序在尝试加载时返回NULL。

奇怪的是调试消息告诉我正在使用所需的DLL,见下文:

Opening flt file...
itr='C:\dev\CgfGen\build32\3dviewer\Debug'
FindFileInPath() : trying C:\dev\CgfGen\build32\3dviewer\Debug\osgPlugins-3.4.1\osgdb_openflightd.dll ...
FindFileInPath() : USING C:\dev\CgfGen\build32\3dviewer\Debug\osgPlugins-3.4.1\osgdb_openflightd.dll
DynamicLibrary::failed loading "osgPlugins-3.4.1/osgdb_openflightd.dll"
Warning: Could not find plugin to read objects from file "pyramid.flt".
Opening flt file failed

我的pyramid.flt是Openflight版本16.5。我正在运行我的应用程序的调试版本。 OSG正在加载osgdb_openflightd.dll的调试版本

有谁知道问题是什么?以及它如何解决?

c++ opengl openscenegraph
1个回答
0
投票

FindFileInPath():使用C:\ dev \ CgfGen \ build32 \ 3dviewer \ Debug \ osgPlugins-3.4.1 \ osgdb_openflightd.dll

这只是意味着OSG发现了一个与它正在寻找的名称相匹配的文件,但并不意味着它成功使用它。下一行:

DynamicLibrary ::加载失败“osgPlugins-3.4.1 / osgdb_openflightd.dll”

表示插件无法加载。这可能是因为插件自身的依赖性存在问题。你是从头开始自己构建OSG和插件吗?

您可以使用depends.exe来检查并查看您的FLT插件所需的其他DLL。您还可以使用SysInternals的Process Monitor之类的东西来查看OSG之后尝试加载的内容

© www.soinside.com 2019 - 2024. All rights reserved.