Not work well restoreContext() on vtkOpenGLRenderWindow

I already know that when I lose WebGL context, there is context restore eventListener and it handle restore process internally(by call vtkOpenGLRenderWindow.restoreContext()).

But I have received some warning message like below and there is no restored object in vtkRenderWindow.

Is this expected result?

Then, how can I restore objects that have added to renderer.

@ken-martin can you comment on this? We may not be fully restoring/resetting everything after the context restore event.

Under what scenario are you bumping up against losing your webgl contexts?

I tested using WebGL’s ‘WEBGL_lose_context’ extension.

The errors definitely point to objects being bound to the old context. I don’t know how extensively restoreContext was tested.

Let me show you the code I tested.
My test code very simple.
just one cone was added to renderer.
And I call loseContext() and call restoreContext() after 3 seconds.

var fullScreenRenderer = vtkFullScreenRenderWindow.newInstance();
var actor = vtkActor.newInstance();
var mapper = vtkMapper.newInstance();
var cone = vtkConeSource.newInstance();
actor.setMapper(mapper);
mapper.setInputConnection(cone.getOutputPort());

var renderer = fullScreenRenderer.getRenderer();
renderer.addActor(actor);
renderer.resetCamera();

var renderWindow = fullScreenRenderer.getRenderWindow();
renderWindow.render();

let originContext, restoredContext;
originContext = fullScreenRenderer.getApiSpecificRenderWindow().getContext();
        
const ext = originContext.getExtension('WEBGL_lose_context');
ext.loseContext();

setTimeout(() => {
    ext.restoreContext();
}, 3000);

Is there something wrong with my code?

Incidentally, I was expecting cones that disappeared from renderer after loseContext() to reappear in restoreContext() but they didn’t.

This looks to be like a bug in vtk.js. Restoring the context should restore the rendering pipeline. Please log an issue on the vtk.js issue tracker.

Thanks for your reply.
I reported it to the vtk.js issue tracker, so please refer to it.