警告:活动的 WebGL 上下文过多。最旧的上下文将丢失(Mapbox+React+Marzipano)

问题描述 投票:0回答:1

我们在我们的一个项目中将 marzipano 与 Mapbox 一起使用,我们用来在地图上显示点,单击任何点我们将在 marzipano 的帮助下显示 360 度图像。我们需要单击多个点才能显示图像,但点击 10-15 次后,我的完整地图变白(屏幕上没有显示任何内容)。

我们收到的这些警告和错误:

WebGL: INVALID_OPERATION: deleteVertexArrayOES: object does not belong to this contextUnderstand this warning
WebGL: INVALID_OPERATION: bindBuffer: object does not belong to this contextUnderstand this warning
WebGL: INVALID_OPERATION: bindTexture: object does not belong to this contextUnderstand this warning
[.WebGL-00001E3C02020D00] GL_INVALID_OPERATION: Must have element array buffer bound.

我还遵循一些步骤来销毁查看器,以便我可以销毁 marzipano 查看器使用的 WEB-GL, 这是它的代码:

async destroyViewerInstance() {
     if (viewer) {
          await viewer.destroyScene(scene);
          await viewer.destroy();
     }
}

我尝试使用这些代码来破坏 web-gl

async destroyViewerInstance() {
    if (viewer) {
       await viewer.destroyScene(scene);
       await viewer.destroy();
    }
 }

但查看器并没有破坏并占用太多 RAM。

reactjs dom mapbox mapbox-gl-js marzipano
1个回答
0
投票

我遇到了完全相同的问题,我当然正在研究 Angular,但以下内容帮助了我

    ngOnDestroy() {
        if (this.viewer) {
            this.viewer.destroyAllScenes();
            this.viewer.destroy();
        }
    }

© www.soinside.com 2019 - 2024. All rights reserved.