Help deciding how to load textures?

Mars_999
Unregistered
 
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
henryj
Unregistered
 
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 14 12,358 Jan 21, 2014 11:19 AM
Last Post: SethWillits
  How can I load a PNG without premultiplied alpha? Prime 6 7,842 Feb 15, 2005 08:52 PM
Last Post: arekkusu
  need help getting quicktime to load textures xDexx 8 4,879 May 7, 2003 03:57 PM
Last Post: xDexx
  Where can I get a library to load 3D Models? Mars_999 4 4,379 Aug 25, 2002 06:05 AM
Last Post: ggadwa