Jump to content
  • Advertisement

Archived

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

wizard341

Checking mem to see if a texture is loaded

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

I want to check my memory to see if a certain texture is loaded, and if it is, not load it into memory again. Anyone have an idea on how to check which textures have been loaded so far?

Share this post


Link to post
Share on other sites
Advertisement
If all textures have the same filenames (ie. you don''t have two textures that have the same data but different filenames) you can just have an array of strings

eg.
//texture.cpp

struct texref_t {
string s;
UINT tex;
};

vector g_texturenames;

int FindTex(const char *name) {
for (int i = 0; i if (strstr(g_texturenames.s, name))
return g_texturenames[i].tex;
}

return -1;
};


GLuint LoadTexture(const char *name)
{

texref_t s;

int g = FindTex(name);

if (g == -1)
return g;

s.s = name;
s.tex = 0;

g_texturenames.push_back(name);

....

Load Texture

....


}


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.

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

Sign me up!