Texture Resource limit - clearing texture memory - manualy dispose all objects not working

Software: Away3D 4.x

Maze, Newbie
Posted: 11 March 2016 03:24 PM   Total Posts: 2

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.CLICKclickAction)
   
   
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 0faces.lengthi++) 
   
{
    cur_mesh 
faces[i] as Mesh
    
for (var j:int 0cur_mesh.subMeshes.lengthj++) 
    
{
     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.

download-link

To reproduce the memory error you have to open the first menu point in the carousel 16 times grin

I really need help with this wink

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

   

Tempy111, Sr. Member
Posted: 11 March 2016 08:07 PM   Total Posts: 133   [ # 1 ]

Can’t you just use the Cube function to make a cube?

something like:

var cubeGeom:CubeGeometry = new CubeGeometry();
var 
cubeMat:BitmapCubeTexture = new BitmapCubeTexture(Whatever 6 images);
var 
mesh:Mesh = new Mesh(cuibeGeomcubeMat); 

which can just be removed via dispose?

4.0 isn’t my thing ^_^ 3.6 is what I use but even that I’m still green with.

 

   

Maze, Newbie
Posted: 14 March 2016 09:16 AM   Total Posts: 2   [ # 2 ]

I did not use a CubeGeometry because i have to achieve something like shown in the attached file. An image has to be kind of wraped around 5 sides of the cuboid like a panting over a canvas. I read that a Mesh with a CubeGeometry does not have SubMeshes which i need for the UV-Offset to position the images correctly.
So i startet with my solution of 6 single meshes building my own kind of cuboid. It works perfekt but as i discribed - i can not clear the textures from the memory.

 

   

Tempy111, Sr. Member
Posted: 14 March 2016 01:39 PM   Total Posts: 133   [ # 3 ]

As I see it, and I’m probably a bit off since I think I’m having cleaning problems of my own (each level brings a drop in frame rate ¬_¬), but setting to null doesn’t clean anything. It just removes the pointer.

now, this isn’t a Away3D problem so I might be able to help..

1) what is texture creation like? in a loop? that often creates a problem
2) are you reusing Textures? which you can do and it takes up less memory in the first place

 

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X