Jump to content
  • Advertisement


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


Checking mem to see if a texture is loaded

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


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;



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.

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!