Texture Management

Started by
10 comments, last by MGB 19 years, 6 months ago
Quote:Original post by Anonymous Poster
Anyway, I dont really see the problem here. It could be that I've forgotten how to use glGenTextures properly, but it seems to me that the only thing you have to do is using some dynamiclly resizable array of integers and allocate new elements (and generate textures for those) when needed.

Problem with the method you suggest it that you "lose" the texture after it's been created. If you create an array of integers with std::vector, or whatever, you have no way of knowing which texture is which; all you have is an anonymous array of integers. If, on the other hand, you use std::map, you can package each CTexture object with a texture name. This way, when you want to find a particular texture, you just ask the std::map object to find it's name, and retrieve the CTexture object. This also saves you from loading multiple copies of the same texture. If you do a quick check in the std::map object for a texture's filename, you can see if it's already loaded. If it is, return a pointer to it. If it isn't, load it, then return a pointer to it...
My opinion is a recombination and regurgitation of the opinions of those around me. I bring nothing new to the table, and as such, can be safely ignored.[ Useful things - Firefox | GLee | Boost | DevIL ]
Advertisement
Take a quick look at this page:

http://www.drizzle.com/~scottb/publish/gpgems1_resourcemgr.htm

This topic is closed to new replies.

Advertisement