WebGL: INVALID_OPERATION: bindTexture: object not from this context

I am creating CesiumWidget dynamically and inserting it into a page with jQuery. After I create a 2nd and subsequent iteration of the widget, after having used Materials/Fabrics with the same texture image I try to reapply, I get repeats of this error for every attempted use of a newly constructed Material:
WebGL: INVALID_OPERATION: bindTexture: object not from this context

When removing the widget, I have tried explicitly calling .destroy() methods on all of the objects: the created materials, scene, widget, etc. This doesn’t seem to make any difference. I’ve also tried a few methods of creating the Materials. This is one method that produces good results on the first instance of the Widget. It’s only after I create a 2nd widget some time later that the errors appear.

material = new Cesium.Material({
fabric : {
type : ‘Image’,
uniforms : {
image : iconURL,
repeat : {
x : 1,
y : 1
}
}
}
});

Hi,

Each viewer is completely separate so you need to recreate the material to use it in the other viewer. Under the hood, WebGL does not yet allow sharing of resources like this between contexts (which equate to Cesium Viewer windows) so this is a reasonable approach for now. Post 1.0 we are also looking at having multiple viewports in the same Viewer window so, for example, there could be two different views of the same scene inside the same viewer canvas, e.g., think picture-in-picture or one on the left and one on the right.

Patrick

Yes, I have received the same error even re-creating the materials for subsequent new CesiumWidget() instances, after the previous has been removed and destroy()'d. I have not tested using multiple simultaneous widgets although I would like to be able to do that too. I’ll look into it some more and see if I can trace the context’s allocations and where they are supposed to be freed.

Thanks!