I have two classes that are both loading the same set of textures via loader.loadTexture(). I stumbled across the TexturePool class, which seems like a loadModelCopy for textures. Is there a global instance of this class that gets created automatically? It seems like TexturePool should be running under the hood whenever any textures get loaded. Does anyone know if that is the case? Or do we have to make our own instance of TexturePool?

A pdir(base) didn’t show anything promising.

thanks in advance,


Yes, the TexturePool is automatically invoked whenever you load a texture via loader.loadTexture(), or implicitly as part of a model via one of the loader.loadModel() variants.

Thus, each time you load a texture with a given filename, if the same file has already been loaded you will get a shared pointer to that previously-loaded texture. You have to go pretty far out of your way to actually load a given image file twice into memory.