Jump to content

dispose in 2.5 alpha nightly


mattlock
 Share

Recommended Posts

Hi the following code gives a webGL error: INVALID_OPERATION: drawElement: no buffer is bound to enabled attribute

 

If you remove the diffuseTexture it works, and I tried calling material.dispose and diffuseTexture.dispose to no avail, I've reverted to 2.4 and this does not occur.

 

Thank you for the amazing work!

 

var material = new BABYLON.StandardMaterial('texture', scene);
        material.diffuseTexture = Util.texture('assets/height.jpg', scene);
        material.emissiveColor = new BABYLON.Color3(0.5, 0.5, 0.5);
        
        var mesh = BABYLON.MeshBuilder.CreateIcoSphere('Ball', {
            radius:64, subdivisions:4
        }, scene);
        mesh.position.x = 64;
        mesh.position.z = 256;
        mesh.position.y = 32;
        mesh.material = material;
        
        setTimeout(() => {
            console.log(mesh);
            console.log(scene.meshes.length);
            setTimeout(() => {
                mesh.visibility = false;
                mesh.dispose();
                console.log(scene.meshes.length);
            }, 1000);
        }, 2000);

Link to comment
Share on other sites

  • 2 weeks later...

I can confirm this is happening with me also, I am using 2.5-beta.

It seems that when you have a diffuseTexture on a mesh that when you dispose of the mesh it causes this hickup and the error shows in the console, for now I am setting the diffuseTexture to null before disposing of the mesh (a simple fix but more code).

PG Repo: http://www.babylonjs-playground.com/#Z3TQT#0

In the console F12 type in sphere.dispose()

Cheers :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...