在Autodesk查看器中获取webGL错误 [英] Getting webGL error in autodesk viewer

查看:138
本文介绍了在Autodesk查看器中获取webGL错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到如下错误:
未捕获的TypeError:无法读取属性'__webglFramebuffer'为null

当我要去的时候到与附加了autodesk查看器的页面链接的另一个页面。我不知道它为什么会来。我在我的网站上使用angularjs,并且该页面的控制器中没有关于查看器的代码。

when i am going to another page linked with the page which has autodesk viewer attached . I dont know why it is coming . I am using angularjs for my web site and there is no code in controller of that page about viewer.

推荐答案

你得到这个错误,因为您没有销毁您离开的页面上的查看器实例,因此当接收页面调整大小等事件时,查看器将尝试重新呈现,并且由于WebGL上下文已被破坏,它将触发此错误。

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
  }
} 

这篇关于在Autodesk查看器中获取webGL错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆