TexHandle increases!

Blitz3D Forums/Blitz3D Programming/TexHandle increases!

WillKoh(Posted 2004) [#1]
The handle of a texture (as obtained by GetEnityBrush(..),GetBrushTexture(..) keeps increasing! I think this is really weird!

I checked it just to see if it was the same as the type-field stored
texture-handle, to not have to perform those two commands mentioned above...


Ross C(Posted 2004) [#2]
When you do that getentitybrush() type commands, i'm sure it creates a new brush, which you need to free when your done with it.


BlackD(Posted 2004) [#3]
Yes it does. Every time you use GetBrushTexture and GetEntityBrush etc, it creates new brushes/textures. You need to do it like this:
surface=getsurface(mesh,1)
brush=getsurfacebrush(surface)
tex=getbrushtexture(brush)
print "texture name:"+texturename$(tex)
freetexture tex
freebrush brush

however, DON'T free the surface. :) GetSurfaceBrush and GetBrushTexture are funny commands that - rather than get the virtual handle of the brush/texture - create a new copy of the brush/texture for painting/texturing elsewhere.