Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.

Mr Lane

Texture storage

This topic is 5322 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys I was after some advice about texture management. I am writing a small app and currently it stores up to 20 textures in an array though of course it is easy to make that larger. Geometry that uses these textures just contains a reference to the array element where the texture it uses resides...so the texture can be found instantly. However if I want to make things scalable and have an unlimited number of textures i need something dynamic. Obviously i could use a linked list, and i do this for my world objects, but i heard that binary search trees or even red-black trees are better for texture lookup beacuse traversal is so fast. I was wondering what professional programs, or what you use for storing your textures, and what you would recommend. Thanks in advance

Share this post

Link to post
Share on other sites
I personally use a std::map (C++), with each element being a structure holding a texture handle and a reference count so that I know when textures can be safely released. A linked list presents the problem (albeit a minor one, unless you have a _lot_ of textures) of having O(n) search time when looking for a specific texture.

My texture handler will also report at program exit which textures were not properly released, and release them, to help debugging.

Blender--The Gimp--Python--Lua--SDL

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!