Clear a scene?

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
Mani2010
Posts: 107
Joined: Sat Jan 16, 2010 4:35 pm
Location: London,UK
Contact:

Clear a scene?

Post by Mani2010 »

I want to exit my scene and go back to my 2d main menu...
I tried using sceneManager->clear() to clear the mesh that was loaded in and that seems fine. Until i exit my program from the 2d menu at which point i get a crash while deleting the device.

Have no way of adding image so i have written stack
Added some of the stack, top part of the stack is....

virtual ~SHWBufferLink()
{
if (MeshBuffer)
MeshBuffer->drop();
}
.
.
.
void CNullDriver::deleteHardwareBuffer(SHWBufferLink *HWBuffer)
{
if (!HWBuffer)
return;
HWBufferMap.remove(HWBuffer->MeshBuffer);
delete HWBuffer;
}
..
..
..
..
SceneManager::~SceneManager
{
.
.
.
if (Driver)
Driver->removeAllHardwareBuffers ();
}
LordNyson
Posts: 31
Joined: Tue Nov 11, 2008 12:02 pm
Location: Perth, Australia

Post by LordNyson »

If you have any existing textures you may need to clear them? But for claritys sake you are saying that you load the scene, then when you quit back to the 2d menu and try to exit it crashes on exit? Does it do this without the sceneManager->clear()? Could it be a problem elsewhere in the code? Such as the recreation of the menu GUI? Perhaps it would also help to link some more code?
But the cage only had "Warning: Vicious Lions" on it! Im a programmer! I only listen to errors!
Mani2010
Posts: 107
Joined: Sat Jan 16, 2010 4:35 pm
Location: London,UK
Contact:

Post by Mani2010 »

But for claritys sake you are saying that you load the scene, then when you quit back to the 2d menu and try to exit it crashes on exit?
Yes, exactly
Does it do this without the sceneManager->clear()?
No, have tried it without, no crash.
Could it be a problem elsewhere in the code? Such as the recreation of the menu GUI?
Menu gui is only created once, at startup. I did not clear the guiEnvironment so i don't think this could be it. Although i do load one texture during the intro. It stays loaded until program exits. As in i don't have any other code anywhere that does anything else to the texture.

Code: Select all

m_pImage->setImage( g_pApp->GetVideoDriver()->getTexture("media/logo2.png") ); 
would i need to clear this image?
Mani2010
Posts: 107
Joined: Sat Jan 16, 2010 4:35 pm
Location: London,UK
Contact:

Post by Mani2010 »

I think i fixed it, well the crash doesn't happen anymore...

I changed this...

Code: Select all

		
g_pApp->GetSceneManager()->clear();
to this...

Code: Select all

		
g_pApp->GetVideoDriver()->removeAllHardwareBuffers();
g_pApp->GetVideoDriver()->removeAllTextures();
g_pApp->GetSceneManager()->clear();
Post Reply