Forums

Full Version: Texture manager class
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
We need a class that handles textures instead of all the other classes having to keep track of them...I think it should do the following:<ul><li>texture loading<li>texture unloading<li>texture drawing<li>keep a reference to each loaded texture (GLuint)<li>if a request to load a texture is made after that texture has already been loaded, just return the stored reference to the texture (don't load it again)<li>keep up with sizes of textures somehow?<li>simplify the way we handle textures<li>handle reloading all the textures if the texture size changes</ul>what else?
sounds good, i wouldn't mind writing itwhat sort of priority? should i be working on that or putting the new track system into the game or improving the track editor?
I'd say if you think it won't take too long, work on the texture manager first. It doesn't seem to me like it'd be terribly hard...half of the functions are already in utility.cpp. It's just a matter of wrapping it up into a nice class with some extra management stuff. I'm thinking of a way to use a <pre>map&lt;string, GLuint&gt;</pre> to map filenames to texture references which would make writing it pretty simple. In fact if you like, I could write it, since it really helps out the new GUI classes the most anyway...
okay, i'm pretty much done with this. i don't know what you meant by "texture drawing" in the list above, but everything else should be in SVN shortly
it's in the trunk now
This looks pretty good, I am using it in the Gui class now.I was thinking that it might make sense to move Draw2D from utility.cpp to the texture manager, but actually now that I think about it, that's not exactly necessary.Speaking of Draw2D, it would be nice to be able to draw textures at a certain opacity level, sort of like the font function can. I had to load extra graphics to make the "disabled arrows" on the wheel that I checked in today. The only difference is that it's only 40% opaque so this could be eliminated if there was an opacity parameter in Draw2D.
no problem, that's easy to do. it's in the trunk.