Skip to content

Commit

Permalink
Fix loading error when WebGL is not supported
Browse files Browse the repository at this point in the history
  • Loading branch information
ricktu288 committed Dec 27, 2024
1 parent 51a3a58 commit 363b15a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/simulator/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,18 +133,19 @@ async function startApp() {
antialias: false,
};
var gl = canvasLight.getContext('webgl', contextAttributes) || canvasLight.getContext('experimental-webgl', contextAttributes);
var ext = gl.getSupportedExtensions('OES_texture_float');

// Currently the color mode is always determined by the renderer, so we need to set it here.
scene.colorMode = 'linear';
var ext = gl.getExtensions('OES_texture_float');

if (!ext) {
throw new Error('OES_texture_float not supported');
throw new Error('OES_texture_float not supported.');
}

// Currently the color mode is always determined by the renderer, so we need to set it here.
scene.colorMode = 'linear';
} catch (e) {
error = e.toString();
error = 'Failed to initialize WebGL: ' + e.toString() + ' Falling back to default renderer.';
document.getElementById('float_color_renderer').checked = false;
document.getElementById('float_color_renderer_mobile').checked = false;
localStorage.rayOpticsUseFloatColorRenderer = "off";
useFloatColorRenderer = false;
}
}
Expand Down

0 comments on commit 363b15a

Please sign in to comment.