MCPcopy Create free account
hub / github.com/microsoft/SandDance / createGLContext

Function createGLContext

docs/app/js/sanddance-app.js:60327–60351  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

60325 height: 600
60326};
60327function createGLContext() {
60328 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
60329 (0, _utils.assert)(isBrowser, "createGLContext on available in the browser.\nCreate your own headless context or use 'createHeadlessContext' from @luma.gl/test-utils");
60330 options = Object.assign({}, CONTEXT_DEFAULTS, options);
60331 var _options = options, width = _options.width, height = _options.height;
60332 function onError(message) {
60333 if (options.throwOnError) throw new Error(message);
60334 console.error(message);
60335 return null;
60336 }
60337 options.onError = onError;
60338 var gl;
60339 var _options2 = options, canvas = _options2.canvas;
60340 var targetCanvas = getCanvas({
60341 canvas: canvas,
60342 width: width,
60343 height: height,
60344 onError: onError
60345 });
60346 gl = createBrowserContext(targetCanvas, options);
60347 if (!gl) return null;
60348 gl = instrumentGLContext(gl, options);
60349 logInfo(gl);
60350 return gl;
60351}
60352function instrumentGLContext(gl) {
60353 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
60354 if (!gl || gl._instrumented) return gl;

Callers

nothing calls this directly

Calls 4

getCanvasFunction · 0.70
createBrowserContextFunction · 0.70
instrumentGLContextFunction · 0.70
logInfoFunction · 0.70

Tested by

no test coverage detected