From 092d4ff1b32dcf2f6c6cba6f22d65e01e8abefdb Mon Sep 17 00:00:00 2001 From: GKraats Date: Wed, 12 Jun 2024 19:17:31 +0200 Subject: [PATCH] Aquarium fails if webgl2 not available --- tdl/webgl.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/tdl/webgl.js b/tdl/webgl.js index 8e3d8867..9bfb1c45 100644 --- a/tdl/webgl.js +++ b/tdl/webgl.js @@ -98,18 +98,16 @@ tdl.webgl.OTHER_PROBLEM = '' + */ tdl.webgl.setupWebGL = function(canvas, opt_attribs, opt_onError, opt_preferredContextType) { function handleCreationError(msg) { - var container = canvas.parentNode; - if (container) { - var str = window.WebGLRenderingContext ? - tdl.webgl.OTHER_PROBLEM : - tdl.webgl.GET_A_WEBGL_BROWSER; - if (msg) { - str += "

Status: " + msg; - } - container.innerHTML = tdl.webgl.makeFailHTML(str); + str = window.WebGLRenderingContext ? + tdl.webgl.OTHER_PROBLEM : + tdl.webgl.GET_A_WEBGL_BROWSER; + if (msg) { + str += "

Status: " + msg; } }; + var str = ""; + opt_onError = opt_onError || handleCreationError; if (canvas.addEventListener) { @@ -131,6 +129,10 @@ tdl.webgl.setupWebGL = function(canvas, opt_attribs, opt_onError, opt_preferredC }, false); } } else { + var container = canvas.parentNode; + if (container) { + container.innerHTML = tdl.webgl.makeFailHTML(str); + } if (!window.WebGLRenderingContext) { opt_onError(""); }