Jump to content
  • Advertisement
Sign in to follow this  

Texture Hashing

This topic is 4415 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

What kind of hashing method should I use to store approximately 200 textures into an array of max_size 4096 indices? Should I hash the textures by their file names? What kind of hashing method should I use to avoid hashing collisions? Can someone give me a little tip?

Share this post


Link to post
Share on other sites
Advertisement
Hashing may not even be necessary. What language are you using, and what API? OpenGL already does something like that with a unique ID that you use to bind the texture. You could just re-use that one.

Share this post


Link to post
Share on other sites
I'm using C++ with DIrectX9 - I'd like to hash the textures so that when I'm rendering I don't have to sift through 200+ texture's names in the array and I can just use the hash algorithm to jump right to the index of the texture that I want.

Share this post


Link to post
Share on other sites
You could consider using STL's map. I believe it uses a tree structure to find its key values (for instance, your file names) - someone correct me if I'm wrong on that.
There's also hash_map, but I don't know much about that.

Cheers,
--Brian

Share this post


Link to post
Share on other sites
Exactly. Maps are there just for this application. If you insist, you can use an hash_map, altough it's not standard and I'm not convinced hashing would be better in this case.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!