freeing textures

Blitz3D Forums/Blitz3D Programming/freeing textures

slenkar(Posted 2006) [#1]
How do you free a texture that is loaded as part of a mesh?
When loadtexture isnt actually used.
When you create a model and assign a texture to it in Unwrap3D the texture is loaded automatically.


Dreamora(Posted 2006) [#2]
You don't need to, it should be freed together with the mesh if no other mesh is using the same texture - flag combination.


AJirenius(Posted 2006) [#3]
I guess his question is if he want to loadtexture a new texture on the mesh instead, how do you free the old one that you don't want to use, or is it freed just by putting another texture on the mesh?


b32(Posted 2006) [#4]
I don't think you can do that. But maybe you could re-save the model without a texture ?


GfK(Posted 2006) [#5]
There's a work-around for this.

First, load your model as normal. Then, load the textures manually (which have actually already been loaded automagically when the model was). Provided that the texture is from the same file, and the texture filters are also the same, only one copy of the texture will exist in memory.

But after calling LoadTexture, you'll have a handle to the texture.


slenkar(Posted 2006) [#6]
thanks for the help


(tu) sinu(Posted 2006) [#7]
nice trick.