Texture Loading and Binding problem

Hello,

I’m really new to opengl and I’am currently trying to implement a little gameengine, I’m checking a lot of tutorials and try to get inspiration and ideas from them, but I’m stuck with a texture problem, when I’m loading my textures with assimp.

I’ve created a Material manager to manage all the textures and materials type, I’ve only done the texture part for the moment. here’s the source :

Header : https://bitbucket.org/Rmdirsudosu/enginev03/src/master/Source/Core/Managers/Material_Manager.h

CPP : https://bitbucket.org/Rmdirsudosu/enginev03/src/master/Source/Core/Managers/Material_Manager.cpp

I’ve hard coded in the constructor some texture import, those are tests and works well but when I remove them from the constructor they don’t load correcly anymore. The first problem I have is, when I want to upload a texture from an other class (calling CreateTexture). The glGenTextures assign already used name, as you can see in this video : https://www.youtube.com/watch?v=tWg3rzNRu_8

I’ve tried many thing, make a static call of CreateTexture, … none of them works, I’m sure that I’ve done something wrong, maybe on the C++ side, I haven’t work with C++ for a while so I might have forgot something.

Here are the calls of the functions CreateTexture : https://bitbucket.org/Rmdirsudosu/enginev03/src/master/Source/Core/Rendering/Models/StaticMesh.cpp

Line 114. if there’s some wierd thing like the GLuint test, it’s me trying to figure out what went wrong.

Here is the staticmesh header : https://bitbucket.org/Rmdirsudosu/enginev03/src/master/Source/Core/Rendering/Models/StaticMesh.h

the second problem I’ve is when I’m loading the texture to the GPU : https://bitbucket.org/Rmdirsudosu/enginev03/src/master/Source/Core/Rendering/Models/Mesh.cpp

Line 75. The function seems to work correctly, it look like it’s binding the correct texture but the only texture that seems to work is the last one, I checked with NSight to see if the textures are load correctly but only the last texture is load correctly as show in this video :
https://youtu.be/zcb3Xxcxulw

Here’s the mesh Header : https://bitbucket.org/Rmdirsudosu/enginev03/src/master/Source/Core/Rendering/Models/Mesh.h

Here is the Model source code currently it’s a bit messy I’ve try some stuff to check if the problem was here. I’ll clean it up and I’ll try to comment it aswell.
CPP : https://bitbucket.org/Rmdirsudosu/enginev03/src/master/Source/Core/Rendering/Models/Model.cpp
Header : https://bitbucket.org/Rmdirsudosu/enginev03/src/master/Source/Core/Rendering/Models/Model.h

I don’t really understand these problems, so maybe I’m trying to do something in a way it’s not supposed to be done, but currently I don’t know openGL enought to figure my way out of this alone. So any help will be really appreciate.

Thanks for reading.