Hey guys,
i’m quite new to away3d 4 and i’m currently developing a litte Application with kind of a 3D-Cube navigation.
I built my own Cube-Class since every face of the cube has to have a different material.
So within this Cube3D Class i create 6 Meshes with BitmapTexture-Materials on PlaneGeometrys.
Since it is a fully dynamic navigation i have to load the same navigation-level over and over again with different external images as src for the cube textures.
If i switch between the navigation-levels a few times the App runs out of texture memory:
Error: Error #3691: Resource limit for this resource type exceeded.
at flash.display3D::Context3D/createTexture()
After serching this forum and the entire web for a solution i think the best way is a clean manual step for step disposal of all bitmapDatas, textures, materials, geometrys, meshes and objects.
I tryed a lot doing so correctly but i obviously make something wrong.
Here is my code in every Cube3D for clearing the memory:
public function kill():void
{
removeEventListener(MouseEvent3D.CLICK, clickAction)
img_bitmap_data.dispose();
img_bitmap_data = null
img_texture.dispose();
img_texture = null
plane_material.dispose();
plane_material = null
img = null
var cur_mesh:Mesh
var cur_sub_mesh:SubMesh
for (var i:int = 0; i < faces.length; i++)
{
cur_mesh = faces[i] as Mesh
for (var j:int = 0; j < cur_mesh.subMeshes.length; j++)
{
cur_sub_mesh = cur_mesh.subMeshes[j] as SubMesh
//cur_sub_mesh.material.dispose();
cur_sub_mesh.subGeometry.dispose();
cur_sub_mesh.dispose();
}
//cur_mesh.geometry.dispose()
cur_mesh.disposeWithChildren();
cur_mesh.dispose();
cur_mesh.disposeAsset();
}
faces = null
parent.removeChild(this)
super.dispose();
super.disposeAsset();
}
I leally stuck with this for a long time now and have lots of hope that someone of you guys has an idea for me what i coult try to get this work!
Here is the complete src package - Flash IDE with FlashDevelop.
To reproduce the memory error you have to open the first menu point in the carousel 16 times
I really need help with this
PS: i also have a starling instance running for the background-image sharing a stage3DProxy with the away3dView and a read about an option to clear the GPU memory through starling, but i do not know how to do that:to the post in this forum