I am removing my three.js canvas from the DOM with a destroy() method that looks like this
destroy() {
cancelAnimationFrame(this.id)
this.renderPass.dispose()
this.customPass.dispose()
this.composer.dispose()
this.renderer.dispose()
window.removeEventListener('resize', this.resize)
window.removeEventListener('mousemove', this.mouseMove)
}
But the dispose method on my this.custompass
which is an instance of ShaderPass
does not work. If I remove this.custompass
from the chain of passes, I can successfully delete the canvas from the DOM and re-init it without any errors. If I add it to the render chain and try to dispose it, I get these errors every frame:
[.WebGL-0x7006e1a900]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : glClear: framebuffer incomplete
Any idea if I am doing something wrong or this is an issue with the dispose() method?
(edited for clarity)