Problem with loading and unloading of resources

Problems building or running the engine, queries about how to use features etc.
Post Reply
Oogst
OGRE Expert User
OGRE Expert User
Posts: 1034
Joined: Mon Mar 29, 2004 8:49 pm
Location: the Netherlands
Contact:

Problem with loading and unloading of resources

Post by Oogst » Sun May 21, 2006 6:42 pm

For The Blob I am using a custom state-manager that loads resources when a level starts and unloads them when the level is quit. Now when the user plays the level, quits to the menu and then starts again, I am getting several resource-not-found errors.

The first error I got was about a particle-template that was not found on reload. So to test things I put that script in a place where it is always loaded while the application is running. Now I got the same error, only for a shader-script. So I moved that too. Now I get the same error for an animation of an Entity (bone-animation, that is). The worst thing about it, is that I am not always getting this error: most of the times the game crashes, sometimes it just runs. Does anyone have any idea why this is?

Because I think unloading resources is the problem, these are some snippets of how I remove objects from my scene:

Code: Select all

sceneNode->detachObject(particleSystem);
sceneNode->getCreator()->removeParticleSystem(particleSystem);
sceneNode->getParentSceneNode()->removeAndDestroyChild(sceneNode->getName());

Code: Select all

sceneNode->detachObject(entity);
sceneNode->getCreator()->removeEntity(entity);
sceneNode->getParentSceneNode()->removeAndDestroyChild(sceneNode->getName());

Code: Select all

Ogre::ResourceGroupManager::getSingleton().destroyResourceGroup(groupName);
I am not removing animations explicitely, because these come with the Entity and were created in 3dsmax.

Is there something wrong with the above snippets, or is the problem probably somewhere else?

Thanks in advance!
0 x
blog.oogst3d.net: my dev blog and portfolio
Ronimo Games: my game dev company
Awesomenauts: platforming MOBA (PC/Mac/Linux/XBox360/PS3/PS4)
Swords & Soldiers: side-scrolling RTS (PS3/Wii/PC/Mac/Linux/iPhone/iPad/Android)
Proun: abstract racing game (PC)
Cello Fortress: mixing game and live cello performance

User avatar
LR
Halfling
Posts: 80
Joined: Mon Dec 13, 2004 7:59 pm
Location: Austria
Contact:

Post by LR » Fri Aug 17, 2007 9:53 am

Sorry to dig out an old post, but it seems I ran into a similiar problem:

Using a custom state manager that loads resources and creates the scene when the level is started and destroys everything when ending.
Currently the scene only consits of an OctreeSceneManager with terrain. The terrain has a custom material utilizing either a GLSL or Cg fragment program.

Things work perfectly fine with the DirectX 9 renderer (using the Cg shader).
With the OpenGL renderer Ogre crashes when using either of the shaders after reloading the level.


I would be very much interested if you found a soloution for your problem, or if my problem is related to yours in any way :wink:
0 x

User avatar
LR
Halfling
Posts: 80
Joined: Mon Dec 13, 2004 7:59 pm
Location: Austria
Contact:

Post by LR » Fri Aug 17, 2007 1:11 pm

It seems the crash has nothing to do with reloading the shader.

When setting up a new scene after unloading the glsl program Ogre crashes when the new scene contains any geometry to be rendered.
It works with an empty scene manager that only contains a camera with a viewport attached, but when adding a skydome -> crash. Even though the sky material doesn't use any shaders.

I'm totally clueless :(
0 x

Post Reply