Struggling to determine how to handle webgl loss in my application (created with electron js) using three js. We are utilizing these two functions:
// renderer is THREE.WebGLRenderer
renderer.context.canvas.addEventListener("webglcontextlost", contextLostFunction);
renderer.context.canvas.addEventListener("webglcontextrestored", contextRestoredFunction);
When I artificially trigger context loss like this:
var canvas = document.getElementById("playground").childNodes[0].childNodes[0];
var gl = canvas.getContext("webgl");
var WEBGL_lose_context = gl.getExtension('WEBGL_lose_context');
WEBGL_lose_context.loseContext();
The webglcontextrestored event is triggered and everything restores correctly.
However, when webgl is lost for real or forced like this:
renderer.context.getExtension( 'WEBGL_lose_context' ).loseContext();
The webglcontextrestored event never triggers. What could be the issue? How can I detect when the context is truly lost?
Appreciate any insights.