You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using the dev branch of the code, and have recently run into a problem. In my scene I have a grid and I'm loading a Mesh in. In the app the user can then choose to load a different mesh and so therefore I need to completely remove the existing one from the scene. The problem is that when I do this, it removes the plane geometry as well and the browser throws a few webgl errors.
I re-created the problem in the example file webgl_test_memory.html file.
Simply add these lines to the end of the 'init' function:
var planeMaterial = new THREE.MeshBasicMaterial( { color: 0x444444, wireframe: true } );
//Add a grid to the viewort
var plane = new THREE.Mesh( new THREE.PlaneGeometry( 30, 30, 30, 30 ), planeMaterial );
plane.rotation.x = - Math.PI / 2;
scene.add( plane );
Is this a bug or am I missing something here?
Also, can I just ask for some clarification on what these functions do...
Just in case anyone is interested - the deallocate methods are indeed used for reference counting. They keep track of all the Three JS objects created in the scene. Each object type has its own array and its important to remove the reference so that there are no dangling pointers.
Hi guys
I am using the dev branch of the code, and have recently run into a problem. In my scene I have a grid and I'm loading a Mesh in. In the app the user can then choose to load a different mesh and so therefore I need to completely remove the existing one from the scene. The problem is that when I do this, it removes the plane geometry as well and the browser throws a few webgl errors.
I re-created the problem in the example file webgl_test_memory.html file.
Simply add these lines to the end of the 'init' function:
Is this a bug or am I missing something here?
Also, can I just ask for some clarification on what these functions do...
Does the deallocate function simply subtract a memory reference and then the deallocateObject and deallocateTexture actually remove it?
Thanks guys
The text was updated successfully, but these errors were encountered: