xeolabs / xeogl

A WebGL-based 3D engine for technical visualization. Not actively maintained.
http://xeogl.org
Other
1.15k stars 264 forks source link

In a single page app #248

Open salfield opened 6 years ago

salfield commented 6 years ago
Description of the problem

I'm trying to use xeogl in the context of a single page app. When I change route I want to destroy the scene, and create a new one when I go to a new file. After, calling scene.clear() or scene.destroy() and then creating a scene as normal when going to the new page I get:

WebGL: INVALID_OPERATION: drawElements: no buffer is bound to enabled attribute

If I don't call scene.clear() or scene.destroy() the new scene is not rendered.

I can't be sure if this is due to some details of my code setup or xeogl features I'm using. Will do some more testing. In the meantime it would be useful to know:

a) Is there a recommended way to do clean-up when using xeogl in a SPA? b) If you have any pointers as to what might cause the above error.

xeogl version
Browser
OS
Hardware Requirements
Artur-Sampaio commented 6 years ago

I will probably propose a Pull Request to fix that, but for now you can manually remove the scene from xeogl.scenes and call the scene's _destroy() method.

it would be something like:

delete this.xeogl.scenes[scene.id]
scene._destroy()