Help deciding how to load textures?
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
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.
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.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Starting with SDL, can't load BMP :( | ngoles | 10 | 6,619 |
Feb 21, 2007 11:25 AM Last Post: djork |
|
| How can I load a PNG without premultiplied alpha? | Prime | 6 | 5,524 |
Feb 15, 2005 08:52 PM Last Post: arekkusu |
|
| need help getting quicktime to load textures | xDexx | 8 | 3,553 |
May 7, 2003 03:57 PM Last Post: xDexx |
|
| Where can I get a library to load 3D Models? | Mars_999 | 4 | 3,703 |
Aug 25, 2002 06:05 AM Last Post: ggadwa |
|

