[osg-users] [osgPlugins] Unable to load texture in relative path

Eon Strife eon_strife at yahoo.com
Sun Nov 26 18:36:38 PST 2017

I have an fbx file (authored) using Maya, which is using two textures, table-cloth-2.jpg and table-cloth-3.jpg. Just say, now the files in this folder

E:\Data\3D Models\Watercolor\fruits-uvs\scenes - JPG\
- table-cloth-2.jpg
- table-cloth-3.jpg
- simple.fbx

With both textures are linked to the materials in the simple.fbx.

Just say, I create another variant of simple.fbx with different texture format, I will be using png format instead of jpeg format for table-cloth-3.jpg,  but I do not modify link to table-cloth-2.jpg. So, now we have the second folder :

E:\Data\3D Models\Watercolor\fruits-uvs\scenes - PNG\
- table-cloth-2.jpg
- table-cloth-3.png
- simple.fbx

I then rename or remove the "E:\Data\3D Models\Watercolor\fruits-uvs\scenes - JPG\" folder to simulate opening it in other PC.

When I loadethe "E:\Data\3D Models\Watercolor\fruits-uvs\scenes - PNG\simple.fbx" into my osg application, the application is unable to load "table-cloth-2.jpg" even though the texture is located in the same folder as the simple.fbx.

I then do some checking. Inside the ReaderWriterJPEG.cpp, I put breakpoint at :

virtual ReadResult readImage(const std::string& file, const osgDB::ReaderWriter::Options* options) const 

I see that it makes three attempts to load the texture, with the value of file parameter :

1st try : E:\Data\3D Models\Watercolor\fruits-uvs\scenes - PNG\E:/Data/3D Models/Watercolor/fruits-uvs/scenes - JPG/table-cloth-2.jpg

2nd try: E:/Data/3D Models/Watercolor/fruits-uvs/scenes - JPG/table-cloth-2.jpg

3rd try: E:\Data\3D Models\Watercolor\fruits-uvs\scenes - PNG\..\scenes - JPG\table-cloth-2.jpg

After that it gives up, and it doesn't try to check in the "scenes - PNG" folder. 

I attach and also upload the scene file to dropbox, in case you want to try it :


Extra information:
- Compiler : VC++ 2013 SP5
- Debug x64
- OSG version 3.5.6 (osg148-*.dll, /osgPlugins-3.5.6)
- FBX SDK 2017.0.1 (possibly)
- The plugins are copied to the correct folders (osgdb_jpegd.dll, osgdb_pngd.dll, and osgdb_fbxd.dll are in "osgPlugins-3.5.6" foder, and libpng16d.dll is in my application root folder).



Thank you!


Read this topic online here:


More information about the osg-users mailing list