JoeyDeVries / LearnOpenGL

Code repository of all OpenGL chapters from the book and its accompanying website https://learnopengl.com
https://learnopengl.com
Other
11.06k stars 2.8k forks source link

Missing textures on backpack.obj #180

Open caochao opened 4 years ago

caochao commented 4 years ago

hi, @JoeyDeVries, please push these textures to your repo. thanks a lot.

loading backpack.obj will log these message: Texture failed to load at path: use.jpg Texture failed to load at path: ular.jpg Texture failed to load at path: al.png

they are not in your repo at path "resources/objects/backpack"

rbarkmore commented 4 years ago

This is similar to issue #152

I get the same error messages using Ubuntu, when trying to run the model loading example. The model loading example runs fine in Windows 10. When in model.h, line 151, it's trying to load 'texture_diffuse' as a type name, it looks like it is only getting 'use', just the last few characters.

So there's more to the issue than just restoring some files. There's something going on with the code that needs debugging.

Not sure if there's a work around, except of course, run the example using Windows....

rbarkmore commented 4 years ago

So a work around would be to create three files with those names.

Navigate to the resources/objects/backpack folder. Make copies of these files and rename the copies as shown:

diffuse.jpg >>> use.jpg normal.png >>>al.png specular.jpg >>> ular.jpg

Then the model loading example will run in Ubuntu. Pretty ugly, but it will work for now.

rbarkmore commented 4 years ago

More details: with Ubuntu 20.04, and gcc 9.x.x, the model loading example has an issue. Working in Debian 9 and compiling with gcc 6.x.x, the model loading example works as expected, without renaming the files.

caochao commented 4 years ago

thanks for you answer @rbarkmore , now I see how this occurs, I will spend some time diving into this issues

rbarkmore commented 4 years ago

Take a look at this issue from Assimp.org

https://github.com/assimp/assimp/issues/3264

@caochao maybe you could try out their recommendation?

rbarkmore commented 4 years ago

I tried out the recommendation from the assimp issue. Using Ubuntu 20.04, when libassimp-dev is installed, version 5.0.1 is installed. Comment out the includes/assimp folder and run cmake with Unix Makefiles, then build. The model loading example should run properly. Note that the problem with not loading textures also occurs with any example that uses models, such as asteroids.

Here's the combination that causes the issue: Ubuntu 20.04, Assimp 5.0.1, and the 'includes/assimp' folder that the compiler finds first, before finding /usr/includes.

Updating assimp to 5.0.1 in github for LearnOpenGL will change the issue from being an assimp issue, into a cmake issue for the project, in other words how to change CmakeLists.txt to find the /usr/includes folder first. If this is acceptable, I could put in a pull request to update assimp to 5.0.1.

caochao commented 4 years ago

I tried out the recommendation from the assimp issue. Using Ubuntu 20.04, when libassimp-dev is installed, version 5.0.1 is installed. Comment out the includes/assimp folder and run cmake with Unix Makefiles, then build. The model loading example should run properly. Note that the problem with not loading textures also occurs with any example that uses models, such as asteroids.

Here's the combination that causes the issue: Ubuntu 20.04, Assimp 5.0.1, and the 'includes/assimp' folder that the compiler finds first, before finding /usr/includes.

Updating assimp to 5.0.1 in github for LearnOpenGL will change the issue from being an assimp issue, into a cmake issue for the project, in other words how to change CmakeLists.txt to find the /usr/includes folder first. If this is acceptable, I could put in a pull request to update assimp to 5.0.1.

well done!

rbarkmore commented 4 years ago

I tried updating assimp in LOGL to 5.0.1 and it does fix the issue in Ubuntu 20.04. Unfortunately, it then causes issues with other Linux versions, such as Ubuntu 16 and 18. Basically, in Linux, if you have an issue like this, comment out the includes/assimp folder in LOGL and rebuild. By commenting out the includes folder, it prevents a conflict between assimp versions.

forest0 commented 2 years ago

Same problem as above, four characters from the filename are eaten, if I include assimp from includes/assimp of this repo.

I have assimp 5.0.1 installed in my system, headers files are under /usr/local/include, if I include assimp from /user/local/include, there is no problem to load texture files. So I also believe it is a version mismatch between header files and the linked library.

BTW, I found a weird thing, whether I comment out the includes/assimp of this repo(by rename the includes/assimp to includes/assimp_bak) or not, the cmake always say Found ASSIMP in /usr/local/include. I don't know it is expected or not, I am not skilled at cmake.

lixit commented 1 week ago

for Linux users, please remove includes/assimp

rm -rf includes/assimp

then run cmake .. and cmake build again. All done!

This is because the included assimp header file and your system assimp version are mismatch.

cause by the final line in CMakeList.txt file:

include_directories(${CMAKE_SOURCE_DIR}/includes)