Open anlumo opened 13 years ago
Of course, I wonder what would happen when I'd have two webgl canvas elements in use at the same time… Fortunately I don't need that right now. Maybe this should better be fixed at the GLGE.Mesh/GLGLE.Material level.
You're right it's not ideal I will take a look into it ASAP. I would link the cache to the glcontext but that isn't known until the collada group is added to a scene and the scene attached to the renderer so without restricting things it's difficult to know how best to cache. I think you're resetColladaCaches is the best way forward for know but with the addition of a cache group property of the collada object. So, It knows which cache to use for instances when multiple contexts are in use. ie: collada.setCacheGroup("default"); GLGE.resetCacheGroup("default");
In my web application it is necessary to remove the WebGL view and create it again without reloading the page inbetween. I discovered that I can't reuse the mesh or material instances, I have to create them again. I'm building some objects manually, and there it works fine that way. However, Collada objects don't work on the second try (no error, but nothing is displayed).
This is caused by local caches in GLGE.Collada which store old meshes and materials that aren't valid any more when creating a new rendering context. I implemented a temporary workaround:
This has to be somewhere at the bottom of glge_collada.js. I just have to call this function after removing the old WebGL canvas, and I can load the Collada file successfully once more after the new context has been created.
However, that's only a workaround, there has to be some cleaner method of fixing this.