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

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

问题描述

我收到如下错误:未捕获的类型错误:无法读取 null 的属性__webglFramebuffer"

当我转到与附加了 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.

推荐答案

您收到此错误是因为您没有销毁您离开的页面上的查看器实例,因此当接收到诸如页面调整大小之类的事件时,查看器将尝试重新-render 并且由于 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.

简单地放置一些在您离开查看器页面时调用的清理处理程序,根据您使用的 angular 版本,您应该可以轻松找到方法,然后放置以下代码来清理查看器:

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天全站免登陆