Getting webGL error in autodesk viewer

前端 未结 1 1049
闹比i
闹比i 2021-01-21 21:30

I am getting error like: Uncaught TypeError: Cannot read property \'__webglFramebuffer\' of null

when i am going to another page linked with the page wh

1条回答
  •  一整个雨季
    2021-01-21 21:58

    You are getting this error because you do not destroy the viewer instance on the page you left, so when receiving event such as page resize the viewer will try to re-render and since the WebGL context has been destroyed it will fire this error.

    Simply place some cleanup handler called when you navigate away from the viewer page, depending on which version of angular you are using you should find how to that easily, then place following code to cleanup the viewer:

    // assumes this.viewer contains your viewer, your code might be different ...
    // make sure viewer has been created
    if (this.viewer) {
    
      // I added this to handle some specific cases
      if(this.viewer.impl.selector) {
    
        this.viewer.tearDown()
        this.viewer.finish()
        this.viewer = null
      }
    } 
    

    0 讨论(0)
提交回复
热议问题