iDevGames Forums
Help deciding how to load textures? - Printable Version

+- iDevGames Forums (
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: Help deciding how to load textures? (/thread-7289.html)

Help deciding how to load textures? - Mars_999 - Feb 20, 2003 08:55 PM

Right now I have a class that loads textures. I really don't want to have 1000's of objects floating around in my code. I have tried to use an array of filenames and a array of textures and send that to my object to load textures so I only have to have 10 or so objects, but that doesn't seem to work right. Works ok to load one texture but not more than one? Don't I want to delete the variables after the texture is loaded since they are no good to me anymore after the texture is loaded? Thanks

Help deciding how to load textures? - henryj - Feb 20, 2003 10:09 PM

There are a couple of ways to load textures depending on how you intend to use them. OpenGl has a concept of texture objects so there is no reason why you can't just use that (as per your example). Write a texture loader class that has a function like...

int LoadTexture( std::string filename, std::vector textureParameterList); // return texture id

Store the texture id's in your model class and glBind them when required.

There is no reason to have extra classes lying around and no reason to delete any variables except when releasing the textures.