|
Post by Nicky Peter Hollyoake on May 29, 2008 15:18:39 GMT -5
Thsi can come in handy to delete the memory, but what about "DeleteTextureMemory()"?
So I can easily do this ...
NewSprite(LoadTexture("Data/F117.PNG")) SprSetPos(100, 100)
DeleteTextureMemory()
And not this ...
Dim Texture
Texture = LoadTexture("Data/F117.PNG")
NewSprite(Texture) SprSetPos(100, 100)
GLDeleteTexture(Texture)
What does people say?
By the way this is just an example, if I was really doing it I would use a varible when using 'NewSprite(INT)'.
Nicky
|
|
|
Post by matthew on May 29, 2008 15:56:55 GMT -5
You can put the NewSprite & LoadTexture Commands on the same line. dim texture
texture = NewSprite(LoadTexture("Data/F117.png")) SprSetPos(100, 100)
glDeleteTexture(texture)
|
|
|
Post by Nicky Peter Hollyoake on May 29, 2008 17:09:48 GMT -5
You can put the NewSprite & LoadTexture Commands on the same line. dim texture
texture = NewSprite(LoadTexture("Data/F117.png")) SprSetPos(100, 100)
glDeleteTexture(texture)
Actually that cannot be done. As it would delete the font charset "NewSprite" would return 1, because its the starting of the memory, LoadTexture would return 2, because 1 has the charset stored in it. And as you're going "Texture = NewSprite(LoadTexture("")) its returning 1 for the sprite, and even if it wasn't this everytime I use "GLDeleteTextures(INT)" well LoadTexture goes back 1. So this can't work. Dim S
S = NewSprite(LoadTexture("Data/F117.PNG")) SprSetPos(100, 100)
Printr S
GLDeleteTexture(S)
Print"Text Gone" Thats why I want "DeleteTextureMemory()" so it will delete all the memory, but still hold onto the charset texture. Nicky
|
|
|
Post by matthew on May 30, 2008 0:52:08 GMT -5
I should have tested that program before I made the post on the forum. I usually put the NewSprite & LoadTexture Commands on One line when I load a Texture, so I thought it would work for deleting them.
|
|
|
Post by Nicky Peter Hollyoake on May 30, 2008 6:35:39 GMT -5
Do you think on a big program with loads of textures, speed would start to slow down because of the memory being hold? Because my program that i'm working on at the moment holds about 110 textures in memory, then i'm loading them into sprites that makes a 110 sprites in memory, then because of the sort of game i'm making i'll be switching around textures, etc, they coud start going into thousands the texture memory, do you think the speed would be better if we could delete that memory? Because I don't need that memory after, so I don't see why I don't delete it.
Nicky
|
|
|
Post by matthew on May 30, 2008 10:29:09 GMT -5
I'm not sure but if you take a look at nehe7 in the Basic4GL program folder you'll see that after the texture has been loaded it gets deleted.
|
|
|
Post by UNDISCLOSED on Apr 8, 2009 9:26:37 GMT -5
Nicky [&&] Leona forever:
Run this and when the nuber of sprites starts to slow down that will tell you how many sprites you can reasonably load:
TextMode(TEXT_BUFFERED) DIM SPR(1000000) DIM I
FOR I = 0 to 1000000 CLS Printr "No. Of sprites: " + I SPR(I) = NewSprite(LoadTex("Data\Ball.Png")) SprSetPos(Rnd()% INT(SpriteAreaWidth()), Rnd()% INT(SpriteAreaHeight())) DrawText() NEXT
EDIT: For me its about 230 before you can notice a slow down but I dont have forrever to completely torture my processor and RAM so give it a go!
|
|