@pixi/core
Version:
Core PixiJS
28 lines (25 loc) • 722 B
JavaScript
import { ENV } from '@pixi/constants';
import { settings } from '@pixi/settings';
const unknownContext = {};
let context = unknownContext;
function getTestContext() {
if (context === unknownContext || context?.isContextLost()) {
const canvas = settings.ADAPTER.createCanvas();
let gl;
if (settings.PREFER_ENV >= ENV.WEBGL2) {
gl = canvas.getContext("webgl2", {});
}
if (!gl) {
gl = canvas.getContext("webgl", {}) || canvas.getContext("experimental-webgl", {});
if (!gl) {
gl = null;
} else {
gl.getExtension("WEBGL_draw_buffers");
}
}
context = gl;
}
return context;
}
export { getTestContext };
//# sourceMappingURL=getTestContext.mjs.map