(canvas, options)
| 60402 | if (ext && "width" in options && "height" in options) ext.resize(options.width, options.height); |
| 60403 | } |
| 60404 | function createBrowserContext(canvas, options) { |
| 60405 | var onError = options.onError; |
| 60406 | var onCreateError = function onCreateError(error) { |
| 60407 | return onError("WebGL context: ".concat(error.statusMessage || "error")); |
| 60408 | }; |
| 60409 | canvas.addEventListener("webglcontextcreationerror", onCreateError, false); |
| 60410 | var _options$webgl = options.webgl1, webgl1 = _options$webgl === void 0 ? true : _options$webgl, _options$webgl2 = options.webgl2, webgl2 = _options$webgl2 === void 0 ? true : _options$webgl2; |
| 60411 | var gl = null; |
| 60412 | if (webgl2) { |
| 60413 | gl = gl || canvas.getContext("webgl2", options); |
| 60414 | gl = gl || canvas.getContext("experimental-webgl2", options); |
| 60415 | } |
| 60416 | if (webgl1) { |
| 60417 | gl = gl || canvas.getContext("webgl", options); |
| 60418 | gl = gl || canvas.getContext("experimental-webgl", options); |
| 60419 | } |
| 60420 | canvas.removeEventListener("webglcontextcreationerror", onCreateError, false); |
| 60421 | if (!gl) return onError("Failed to create ".concat(webgl2 && !webgl1 ? "WebGL2" : "WebGL", " context")); |
| 60422 | return gl; |
| 60423 | } |
| 60424 | function getCanvas(_ref) { |
| 60425 | var canvas = _ref.canvas, _ref$width = _ref.width, width = _ref$width === void 0 ? 800 : _ref$width, _ref$height = _ref.height, height = _ref$height === void 0 ? 600 : _ref$height, onError = _ref.onError; |
| 60426 | var targetCanvas; |
no test coverage detected