1
votes

I have a problem loading an openflight (*.flt) model into Openscenegraph using a simple test app:

#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;
}

This should read the file pyramid.flt, which is in my executable directory by passing the file as argument to the application. However, OSG does not seem to be able to load the required Openflight plugin to indeed read the file. And thus the program returns NULL when trying to load it.

The strange thing is that the debug messages tell me that the required DLL is being used, see below:

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

I the pyramid.flt is in Openflight version 16.5. I am running the debug version of my app. OSG is loading the debug version of osgdb_openflightd.dll

Does anyone have any idea on what the problem is? and how it can be solved?

1

1 Answers

0
votes

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

This just means that OSG has discovered a file matching the name of the one it's looking for, but doesn't mean that it is successfully USING it. The next line:

DynamicLibrary::failed loading "osgPlugins-3.4.1/osgdb_openflightd.dll"

Indicates that the plugin failed to load. This could be because of a problem with the plugin's own dependencies. Did you build OSG and the plugins yourself, from scratch?

You can probably use depends.exe to check and see what other DLLs your FLT plugin requires. You could also use something like SysInternals' Process Monitor to see what OSG was trying to load after