I'm working on a simple OpenGL project and I'm new to C++. I've been slowly adding features to a very simple primitive 3D "engine" and I've worked to make sure it compiles cross-platform.
I have a make file that I run for OSX and Linux (Ubuntu) and for Windows I have a Visual Studio solution file modified to work with the directory structure of the project.
Each time I make changes I make sure to compile and test on each platform, and its been all great until I added support for load models using Assimp. More specifically, loading models was fine but loading textures is what caused the issue- or rather, reading the texture file name.
What's peculiar is that this code actually runs and compiles properly on all the platforms I'm targeting: Linux (Ubuntu), OSX, and Windows 10- except that in Ubuntu (and only in Ubuntu) the aiString
object from Assimp does not seem to be returning the name of the texture file.
This is the code snippet I've narrowed it down to that really displays my problem:
aiString path;
mat->GetTexture(aiTextureType_DIFFUSE, 0, &path);
fprintf(stderr, "Loading texture '%s'...\n", path.data);
std::string full_path = _model_load_path + std::string(path.C_Str());
fprintf(stderr, "Full path: '%s'\n", full_path.c_str());
This is the output on OSX and Windows 10:
Loading texture 'glass_dif.png'...
Full path: 'resources/meshes/nanosuit/glass_dif.png'
This is the output on Ubuntu:
Loading texture ''...
Full path: 'resources/meshes/nanosuit/'
Sure enough the textures are loaded and applied to the model correct in OSX and Windows 10, but not in Ubuntu. Everything else seems to work, including loading the model (it just shows up as black colored since the shader can't sample the texture color).
The only think I can think of is the version I have installed of libassimp-dev
, which is 4, versus 5 on OSX. But I'm a skeptical v4 and all before couldn't load textures. Could it be how I'm compiling it?
What should I start looking into to troubleshoot this? I'm using gcc on Ubuntu and clang on OSX.