【问题标题】:Warning: "Too many active WebGL contexts. Oldest context will be lost" (WebGLRenderer.js)警告:“太多活动的 WebGL 上下文。最旧的上下文将丢失”(WebGLRenderer.js)
【发布时间】:2019-09-26 21:21:22
【问题描述】:

在 Autodesk Forge Viewer 中,我无法在同一页面上实例化超过 6 个查看器 (Autodesk.Viewing.ViewingApplication)。

我尝试过这里提出的解决方案,但它不起作用: There are too many active WebGL contexts on this page, the oldest context will be lost. [dedup.min.js]

我使用的函数:

Autodesk.Viewing.Initializer(options, function onInitialized(){
                this.viewerApp = new Autodesk.Viewing.ViewingApplication(this.div_id);
                this.viewerApp.registerViewer(this.viewerApp.k3D, Autodesk.Viewing.Private.GuiViewer3D, { extensions: ['PropertyInspectorExtension']});
                this.viewerApp.loadDocument(documentId, onDocumentLoadSuccess, onDocumentLoadFailure);
            }.bind(this));

显然,有一种方法*可以使用 Three.js 来实现,但它是否以某种方式在 Autodesk Forge 中实现?不然我自己都不知道怎么弄。

*答案: Display multiple instances of three.js in a single page Is it possible to enable unbounded number of renderers in THREE.js?

*结果示例: https://threejs.org/examples/webgl_multiple_elements.html

【问题讨论】:

  • Autodesk Forge Viewer 中未实现。也许您可以考虑设计您的页面,以便一次只有一个视图处于活动状态。您也可以尝试使用virtual-webgl。您可能应该像自述文件中提到的那样禁用 webgl2。

标签: webgl autodesk-viewer


【解决方案1】:

我知道这是一种解决方法,但您可以将此命令行开关与 Chrome 一起使用:

--max-active-webgl-contexts=<number>

当然,这只会为您解决问题,而不是其他任何人,但有时这就足够了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-02-27
    • 2021-10-18
    • 2021-12-03
    • 1970-01-01
    • 1970-01-01
    • 2023-03-14
    • 2020-07-31
    • 1970-01-01
    相关资源
    最近更新 更多