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 363b15a commit 94b1fbc
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/simulator/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ async function startApp() {
antialias: false,
};
var gl = canvasLight.getContext('webgl', contextAttributes) || canvasLight.getContext('experimental-webgl', contextAttributes);
var ext = gl.getExtensions('OES_texture_float');
var ext = gl.getExtension('OES_texture_float');

if (!ext) {
throw new Error('OES_texture_float not supported.');
Expand All @@ -142,11 +142,9 @@ async function startApp() {
// Currently the color mode is always determined by the renderer, so we need to set it here.
scene.colorMode = 'linear';
} catch (e) {
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;
alert(e.toString() + ' Falling back to default renderer.' + '\n' + i18next.t('simulator:common.reloadToTakeEffect'));
return;
}
}

Expand Down

0 comments on commit 94b1fbc

Please sign in to comment.