get unloadTexture flag?

Started by MichaelJPCT, August 16, 2016, 05:46:43 PM

Previous topic - Next topic

MichaelJPCT

i think it's good that TextureManager has a flag indicating whether a texture is loaded/unloaded, if one needs to strictly manage texture memory usage.

EgonOlsen

I'm not sure why this is needed. You can simply flag all unneeded textures for unload. It doesn't hurt if you do it on textures that aren't uploaded anyway.

MichaelJPCT

an unloaded texture is loaded again automatically when the object3d is rendered. this is not easily known by the  application, but the engine knows it , right?

EgonOlsen

Yes, but I don't get the point. Why do you have to know that?

MichaelJPCT

because i have some large textures that i want to unload in a certain condition, and don't want them to be loaded accidentally.
i can write code like this:
if (Texture.isLoaded(frameBuffer)) TextureManager.unloadTexture(frameBuffer, texture);
but , i have other way : i can hide the object3d that has the texture, then the texture won't be loaded accidentally. so it's OK without knowing the flag.

EgonOlsen

You can just call unload on them. It doesn't matter if they have been uploaded. If your condition to unload them is true, the internal state doesn't matter. The semantics are exactly the same: If it has been uploaded, unload it. If it hasn't, do nothing. It doesn't matter if you check before because the engine does it anyway.