WebGL - Handling Lost Context

In this episode, I discuss how to handle lost context in WebGL.
Concepts:
  • When the GPU is using too many resources (perhaps another tab is using the GPU as well), and the browser frees up resources to regain control.
  • gl.isContextLost()
  • gl.getExtension('WEBGLlosecontext').loseContext()
  • gl.getExtension('WEBGLlosecontext').restoreContext()

RESOURCES:

  • https://github.com/davidwparker/programmingtil-webgl/tree/master/0092-lost-context-part-1
  • https://developer.mozilla.org/en-US/docs/Web/API/WEBGLlosecontext/loseContext
  • https://developer.mozilla.org/en-US/docs/Web/API/WEBGLlosecontext/restoreContext
© programmingtil.com