Skip to content

THREE.WebGLRenderer: Error creating WebGL context. #185

@time-to-beem

Description

@time-to-beem

We are using ifc.js for one year in our application.

We have a bug since the beginning. It is a hard one to solve. It only happens sometimes after we update our application. When a user open an ifc file, the following code:

      this.viewer = new IfcViewerAPI({
        container: this.container,
        backgroundColor: new Color(0xffffff),
      })

this.container: <div id=​"viewer-container" style=​"top:​ auto;​ left:​ auto;​ display:​ block;​ outline:​ none;​ border-radius:​ 4px;​ border:​ 1px solid rgba(0, 0, 0, 0.12)​;​ background-color:​ white;​ width:​ 100%;​ height:​ 100%;​ min-height:​ 500px;​">​</div>​

throws the error: "THREE.WebGLRenderer: Error creating WebGL context.".

One solution to solve this is to tell the user cleaning all the app data and to refresh the page.

I opened an issue in the Discord channel this summer. But I don't have access anymore. So I open it again here.

It happen on different computer and browsers. So it is not a material issue and does not seem to be a material issue.
From what I saw on the internet, it may come from "WebGL Context Limit" or maybe "If you're using OffscreenCanvas in a Worker, make sure it's supported in your target browsers."

We started with "web-ifc-viewer": "^1.0.214" and now we use "web-ifc-viewer": "^1.0.216".

Even if the bug seems to depend on the data of my application, it seems to happen because ifc.js does not handle webGL correctly, especially the "context limit", it should never be reached, or at least throw a clear error message explaining if it comes from the ifc model or from loading to many models at the same time...

I can't find the difference between what I give to the ifc viewer when it crashes and when it doesn't.
I think there was more information in the issue opened on the discord.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions