javascript 错误:WebGL:超过了此主体的 16 个实时 WebGL 上下文,丢失了最近最少使用的上下文

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/33800600/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 16:55:45  来源:igfitidea点击:

Error: WebGL: Exceeded 16 live WebGL contexts for this principal, losing the least recently used one

javascriptwebgl

提问by Alex

I have a JavaScript using the THREE.jspackage, I made some changes, saw the error, and undid all of the changes I have made.

我有一个使用该THREE.js包的 JavaScript ,我做了一些更改,看到了错误,并取消了我所做的所有更改。

However, the following error remained:

但是,仍然存在以下错误:

Error: WebGL: Exceeded 16 live WebGL contexts for this principal, losing the least recently used one.

错误:WebGL:超过了此主体的 16 个实时 WebGL 上下文,丢失了最近最少使用的上下文。

A google-search did not reveal something useful (16 hits!).

谷歌搜索没有发现有用的东西(16 次点击!)。

Anyone has any idea what is going on? Maybe this error has nothing to do with my script, but with the browser itself?

任何人都知道发生了什么?也许这个错误与我的脚本无关,而是与浏览器本身有关?

回答by shopofolive

In my case, the solution was as simple as closing the browser window, opening a new one and reloading your project. The error appears only after I've reloaded my project in the same window more than 16 times.

就我而言,解决方案就像关闭浏览器窗口、打开一个新窗口并重新加载您的项目一样简单。只有在我在同一窗口中重新加载项目超过 16 次后才会出现该错误。

回答by roskelld

I'm seeing this error in FireFox (55) it's happened across a number of small test projects I've been working on.

我在 FireFox (55) 中看到此错误,它发生在我一直从事的许多小型测试项目中。

The only solution I've found is to close and reopen FireFox, which leads me to believe that something isn't getting cleared out upon a page refresh. I've also noticed that leaving my browser open over night can result in very poor performance the following day until I reboot my PC. Perhaps either a Threejs issue or a FireFox (55) one when dealing with WebGL.

我找到的唯一解决方案是关闭并重新打开 FireFox,这让我相信在页面刷新时某些内容没有被清除。我还注意到,在我重新启动 PC 之前,让浏览器整夜打开会导致第二天的性能非常差。在处理 WebGL 时,可能是 Threejs 问题或 FireFox (55) 问题。

I'm going to continue investigating it as I work.

我将在工作时继续调查它。

回答by Thomas Nadin

There is a fixed number of WebGL context instances available in Chromium, 16: https://code.google.com/p/chromium/issues/detail?id=226868

Chromium 中有固定数量的 WebGL 上下文实例可用,16 个:https: //code.google.com/p/chromium/issues/detail?id=226868

It is possible you've either got 17+ tabs open simultaneously or you have one or context with a combined pixel resolution greater than 16 * 1024 * 1024.

您可能同时打开了 17 个以上的选项卡,或者您有一个或上下文的组合像素分辨率大于 16 * 1024 * 1024。