Freeing a texture
Blitz3D Forums/Blitz3D Programming/Freeing a texture
| ||
say if i load a sprite/texture. then i load the new texture/sprite using the same handle, will it free the old one from memory? ie.Tex=LoadSprite("fire.bmp") Tex=LoadSprite("spell.bmp") |
| ||
I wouldn't have thought so. Not until you exit the program anyway, at which point Blitz apparently cleans everything away. Question is: why would you want to use such bad programming practices? It's not hard to keep track of everything you create or load and free it again. It's a tad boring, I suppose, but it's not hard. |
| ||
tex is just a variable to store the mesh handle which is the return-value of the loadanything function. This way you would simply "forget" the handle. |
| ||
i think not free it - just shift n replace it... it's like something to do with FIFO. it shift the first texture a bit to give a place to put in new texture. btw - 'tex' only handle n nothing to do with bitmap size etc. so it still using 'memory' i think |
| ||
To make sure, and to preserve memory add these lines of code:Tex=LoadSprite("fire.bmp") ........ If Tex>0 Then FreeSprite Tex Tex=LoadSprite("spell.bmp") |
| ||
Right cool, thanks. It was just i didn't wanna keep on freeing and copying textures all the time. But it should be cool, thanks all :D |