Hey guys. (in the beginning sorry for my bad English)
I read this forum over 4 months and found here lot of interesting things. I use the knowledge I found here to build my app. And now I have a problem that i can resolve. Namely:
“How to dispose unused instances of Geometry”
what do my app and why i need to dispose
I created some (around 20) models in 3dmax
used sea3d to load them to away3d
I need one model to be seen in 3dview in a time.
I have menu to change currently displayed model.
I can display up to 6 different models in a row and i have this error:
Error: Error #3691: Resource limit for this resource type exceeded.
at flash.display3D::Context3D/createVertexBuffer()
at away3d.core.base::SubGeometry/activateUVBuffer()
at away3d.core.base::SubMesh/activateUVBuffer()
at away3d.materials.passes::CompiledPass/render()
at away3d.materials::MaterialBase/renderPass()
at away3d.core.render::DefaultRenderer/drawRenderables()
at away3d.core.render::DefaultRenderer/draw()
at away3d.core.render::RendererBase/executeRender()
at away3d.core.render::DefaultRenderer/executeRender()
at away3d.core.render::RendererBase/render()
at away3d.textures::PlanarReflectionTexture/render()
at pz_konfigurator_2013/onEnterFrame()
I found same problem on a forum and there was solution: dispose unused instances of Geometry, but how to do this properly, i want disposed geometry to be reused so i can display it on view as many times as i want
i have:
for (var i:int = 0; i < MESH_COUNT; i++){
this.sea3d[i] = new SEA3D(config);
this.sea3d[i].addEventListener(SEAEvent.COMPLETE, this['onComplete_'+i]);
this.sea3d[i].loadBytes(new this['Mesh_'+i]());
}
then
this.mesh[i] = this.sea3d[i].getMesh("profil_D"+i);
i use this code to replace meshes:
if(this._meshExists){
scene.removeChild(this.mesh[this.activeMesh]);
} else {
this._meshExists = true;
}
this.activeMesh = id;
scene.addChild(this.mesh[this.activeMesh]);
i tried to do
this.mesh[this.activeMesh].dispose()
and
this.mesh[this.activeMesh].subMeshes[i].dispose()
for all submeshes
and that doesn’t work still have Error #3691 and furthermore cant used that mesh again
please help