Horde3D
http://horde3d.org/forums/

h3dClear - clearing too much?
http://horde3d.org/forums/viewtopic.php?f=2&t=1856
Page 1 of 1

Author:  tshannon [ 22.01.2013, 04:09 ]
Post subject:  h3dClear - clearing too much?

I'm trying to clear out everything before loading the next level in my game, and I'm running into a thrown fault on h3dRender after I call h3dClear.

When I level loads, I call h3dClear, then reload my pipeline, and readd a camera, then set my viewport and resize my pipeline buffer.

It's literally the same code I use when the engine first starts up, except I'm getting a fault after I call the clear.

In my testing, I've found a few interesting things that I hope one of you guys can clear up for me.

First, instead of doing h3dClear, I tried manually removing all loaded nodes, and all resources. This works fine, but after checking the loaded resources, I'm seeing that calling h3dRemoveResource doesn't seem to actually remove the resources. They still show up as loaded. I'm guessing they'll get cleaned up eventually when the reference count drops to 0? No idea what's still holding the references though.

So after that I decided to look at the loaded resources right after my initial load and compare it to after I do my clear and reload my camera and pipeline.

Initial Load: [$Tex2D $TexCube $Tex3D pipelines/hdr.pipeline.xml pipelines/globalSettings.material.xml pipelines/postHDR.material.xml]

After clear and reload: [pipelines/hdr.pipeline.xml pipelines/globalSettings.material.xml pipelines/postHDR.material.xml textures/ambientMap.dds shaders/postHDR.shader shaders/utilityLib/fragPostProcess.glsl]

So, what I'm seeing is missing is the $Tex2D, $TexCube, and $Tex3D resources. What are these, and how do I reload them, and if I can't reload them, why does h3dClear, clear them at all?

I haven't found any reference to any of these in the forums yet. So I'm curious how other people do their level changes.

Author:  Roland [ 22.01.2013, 17:03 ]
Post subject:  Re: h3dClear - clearing too much?

tshannon wrote:
In my testing, I've found a few interesting things that I hope one of you guys can clear up for me.

First, instead of doing h3dClear, I tried manually removing all loaded nodes, and all resources. This works fine, but after checking the loaded resources, I'm seeing that calling h3dRemoveResource doesn't seem to actually remove the resources. They still show up as loaded. I'm guessing they'll get cleaned up eventually when the reference count drops to 0? No idea what's still holding the references though.

So after that I decided to look at the loaded resources right after my initial load and compare it to after I do my clear and reload my camera and pipeline.

Initial Load: [$Tex2D $TexCube $Tex3D pipelines/hdr.pipeline.xml pipelines/globalSettings.material.xml pipelines/postHDR.material.xml]

After clear and reload: [pipelines/hdr.pipeline.xml pipelines/globalSettings.material.xml pipelines/postHDR.material.xml textures/ambientMap.dds shaders/postHDR.shader shaders/utilityLib/fragPostProcess.glsl]

So, what I'm seeing is missing is the $Tex2D, $TexCube, and $Tex3D resources. What are these, and how do I reload them, and if I can't reload them, why does h3dClear, clear them at all?

I haven't found any reference to any of these in the forums yet. So I'm curious how other people do their level changes.


Hi.
From the manual (-Advanced Topics -Pipeline Specification):
Texture defines a default texture that is used if no texture map is specified in a material; the initial value for sampler2D is $Tex2D (white default texture) and $TexCube (default cube map with black faces) for samplerCube

They are created in egModules.cpp. I guess it would make sense for h3dClear() to keep the default resources alive...

Regarding h3dRemoveResource():
Do you call h3dReleaseUnusedResources() afterwards, as is explained in the function's documentation?


In the RecastNavigationSample I add my camera node and other resources (pipelines/font material) on startup and never remove them. New scenes are added by adding a H3DResTypes::SceneGraph resource to the root node, which is the only node and resource I have to remove to get rid of the entire scene. The camera, its pipleines, etc. are never removed.
So far ( :? ) I haven't encountered any errors.

Author:  tshannon [ 22.01.2013, 21:15 ]
Post subject:  Re: h3dClear - clearing too much?

Thanks for the info. That pretty much explains everything.

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/