I have a function that makes a texture, and it works. It is showing up in the game, however, it’s not getting used the way I want it to be used.
I have a vector, vector <GLuint> textureList
The purpose of the list is to store all the textures for the game I’m making (simple 2d game where things are quads with images pasted on them, the textures) I want to do it this way so that the least amount of memory is used, since each texture will only be stored once. Each object holds an int value that holds it’s textures location in the list. When I go to render the object in the game, my plan was to call
glBindTexture(GL_TEXTURE_2D, textureList[object.indexNumber] );
My problem lies in when I make the texture and try to save it into the list. I make GLuint tempTexture then I pass this into my CreateTexture fucntion, which takes a string (the image file’s name) and a GLuint passed by reference. That works fine.
However, I know for a fact that when I do textureList[i] = tempTexture; it causes a crash (I have a log set up and it shows that it is starting this step but that it is never finishing this step. i also has a value).
I’m pretty new to openGL but this is baffling me. Why can’t I assign the value in tempTexture to the textureList when they are both the same data type? If I comment out that command, it works