There are some errors and warnings after I changed canvas for VTK wasm.
The related post: https://www.weiy.city/2023/11/change-canvas-for-vtk-wasm-project/
INVALID_OPERATION: UDesignCommonDataModel.js:8 WebGL: INVALID_OPERATION: delete: object does not belong to this context
_glDeleteTextures
GL_INVALID_OPERATION: Texture format does not support mipmap generation.
WebGL: INVALID_OPERATION: bindFramebuffer: object does not belong to this context
GL_INVALID_OPERATION: Blit feedback loop: the read and draw framebuffers are the same.
MyDataModel.js:8 Uncaught TypeError: Cannot read properties of null (reading 'bindFramebuffer')
at _glBindFramebuffer (MyDataModel.js:8:211681)
at MyDataModel.wasm:0x4f6ddb
at MyDataModel.wasm:0x4e5e56
We need to free up graphics resources with the old window before we render again.
/**
* Free up any graphics resources associated with this window
* a value of NULL means the context may already be destroyed
*/
void ReleaseGraphicsResources(vtkWindow*) override;
worker.cpp:
void Worker::ChangeRenderWindow()
{
//...
vtkSDL2OpenGLRenderWindow* oldSDLWin = vtkSDL2OpenGLRenderWindow::SafeDownCast( m_RenderWindow );
oldSDLWin->ReleaseGraphicsResources( oldSDLWin );
/*
myDataModel;.js:8 Uncaught TypeError: Cannot read properties of null (reading 'bindFramebuffer')
at _glBindFramebuffer (myDataModel;.js:8:211681)
at UDesignCommonDataModel.wasm:0x4f6ddb
at UDesignCommonDataModel.wasm:0x4e5e56
*/
m_RenderWindow = newWin;
m_RenderWindow->Render();
m_RenderWindowInteractor->Start();
}