Skip to content

fix contextrestored webgl renderer call#1476

Merged
BryonLewis merged 6 commits intomasterfrom
webrender-setup-call
Apr 23, 2026
Merged

fix contextrestored webgl renderer call#1476
BryonLewis merged 6 commits intomasterfrom
webrender-setup-call

Conversation

@BryonLewis
Copy link
Copy Markdown
Contributor

@BryonLewis BryonLewis commented Apr 21, 2026

Noticed a frequent issue in BatAI with this specific error:
d.renderWindow(...)._init is not a function

With this stack trace:

    m_contextRenderer.setResetScene(false);
    canvas.get(0).addEventListener('webglcontextlost', function (evt) {
      return evt.preventDefault();
    }, false);
    canvas.get(0).addEventListener('webglcontextrestored', function () {
      return m_viewer.renderWindow()._init();
    }, false);
    if (m_viewer.renderWindow().renderers().length > 0) {
      m_contextRenderer.setLayer(m_viewer.renderWindow().renderers().length);
    }
    m_this.canvas(canvas);

The specific line is here: https://github.com/OpenGeoscience/geojs/blob/master/src/webgl/webglRenderer.js#L96

I'm guessing it can be happening with annotators and BatAI because of the rather large webGL context it can jump between in a SPA (very large images tiled together along with a decent amount of line annotations).

The problem is that it apppears that the m_viewer.renderWindow() doesn't have a function called ._init()
See: https://github.com/OpenGeoscience/geojs/blob/master/src/vgl/renderWindow.js
Specifically, there seems to be a function called _setup and not _init at: https://github.com/OpenGeoscience/geojs/blob/master/src/vgl/renderWindow.js#L131

It looks like items outside of /vgl use _init() frequently but items inside of that folder seem to use _setup more often.

20260423 Update:

@BryonLewis BryonLewis force-pushed the webrender-setup-call branch from 0f54f80 to bf54180 Compare April 21, 2026 19:05
@BryonLewis BryonLewis requested a review from manthey April 21, 2026 19:05
@BryonLewis BryonLewis force-pushed the webrender-setup-call branch from e3fd60a to 190b24d Compare April 23, 2026 13:16
@BryonLewis BryonLewis force-pushed the webrender-setup-call branch from 190b24d to 37052c7 Compare April 23, 2026 13:23
Copy link
Copy Markdown
Contributor

@manthey manthey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent. Thanks for working through this.

@BryonLewis BryonLewis merged commit 275b3ac into master Apr 23, 2026
12 checks passed
@BryonLewis BryonLewis deleted the webrender-setup-call branch April 23, 2026 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants