Help deciding how to load textures?

Post: #1
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
Quote this message in a reply
Post: #2
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.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Starting with SDL, can't load BMP :( ngoles 16 29,942 Feb 16, 2017 12:17 AM
Last Post: Nicolredmay
  SOIL_load_OGL_texture - failing to load texture kropcke 3 13,990 Sep 5, 2012 10:08 AM
Last Post: kropcke
  How can I load a PNG without premultiplied alpha? Prime 6 13,721 Feb 15, 2005 08:52 PM
Last Post: arekkusu
  checking CPU and video card load NYGhost 2 5,806 Jul 1, 2004 10:01 PM
Last Post: SOUR-Monkey
  need help getting quicktime to load textures xDexx 8 9,199 May 7, 2003 03:57 PM
Last Post: xDexx