Removing Meshes from scene and/or memory [Help needed badly!

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
DoritoX
Posts: 16
Joined: Fri Mar 11, 2011 2:16 pm
Location: 144

Removing Meshes from scene and/or memory [Help needed badly!

Post by DoritoX »

Hey,

For the past few days, i've been searching my butt off on how to actually remove meshes from the scenemanager and or the memory.

Everytime i try "getSceneNodeFrom[Id/Name/etc.](...)->remove[ /All]();
the application freezes.
If i just test "sydney->remove[ /All](); or smgr->remove[ /All](sydney); it also just freezes.

I decided to come ask for help, I would appreciate it alot!

Thanks!!
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Post by Radikalizm »

Try to use smgr->addToDeletionQueue(ISceneNode* node), this will let the scene manager remove a node as soon as it's safe to remove it

http://irrlicht.sourceforge.net/docu/cl ... 8d7bf31f5a
DoritoX
Posts: 16
Joined: Fri Mar 11, 2011 2:16 pm
Location: 144

Post by DoritoX »

Thanks for the fast reply,
However, my game still freezes!
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Post by Radikalizm »

Any error codes? Warnings? Crashes? Or is it just a freeze, and nothing else?
DoritoX
Posts: 16
Joined: Fri Mar 11, 2011 2:16 pm
Location: 144

Post by DoritoX »

Just a freeze unfortunately, however i think i may have found it
it turned out to be a fault in another class i made.

So thanks alot, i'm good now!

so final question(s), does this function remove both texture+mesh?
and also, does it remove it/them from just the scene? or also the memory?

Thanks!
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Post by Radikalizm »

I can't answer this for sure, it's been a while since I've had to do actual heavy memory management in irrlicht
I do know however that there is an issue with removing textures from memory, I believe it's something to do with the fact that it isn't that easy to check whether they are still being referenced by an object or not
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Post by serengeor »

It shouldn't be removed since other nodes might be using it at that moment, so you should clean them from IVideoDriver class. But you also shouldn't remove the texture everytime you remove node thats using it, unless its important in what you plan.
Working on game: Marrbles (Currently stopped).
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

All textures and meshes are stored in their caches. So when removing from the scene graph, you still have one version in the cache. You can remove them from mesh manually, and then also free the memory (both CPU and GPU).
Post Reply