After developing a program using OSG, you might sooner or later package all needed executable (*.exe, *.dll) and copy/deploy them to the target machines.
It is not uncommon that when you open a model, e.g. OBJ, 3DS, FLT files, all works right, except for the textures, missing!
There might be multiple reasons for this missing textures:
- Have you included the TIFF, PNG, JPEG plugins when compiling the OSG source code? If not, include them in the cmake file;
- Make sure the texture images (e.g. *.tiff, *.png) is linked in the right path. For instance, when you open an object file, there might be an accompanying MTL file, which you can open with Notepad or other text editors to see which image is used as the textures
- Try to use other model viewers, such as Blender, Maya or ClockStone FBX Viewer etc. to verify that the models themselves are no problem.
Yes, you did everything, otherwise you won’t read this blog, , but the problem is, it still doesn’t work.
To troubleshoot this, a good way is to use osgviewer command line utility, which is in the bin\ folder of the OSG directory:
When you run that, some errors might popup, and this is an opportunity to diagnose where is wrong! Lovely!
In the above example, the libtiff.dll cannot be found. You can locate this dll in your development machine, and copy it to the same folder as your exe file on the target machine, or simply copy this dll to the windows\system32\ folder of the target machine. Done!
Thanks God. Finally we made it!