gl-react-dom
Version:
DOM implementation of gl-react, an universal React library to write and compose WebGL shaders
18 lines (17 loc) • 575 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
const getContext = (canvas, opts, version) => {
let gl = null;
if (version === "webgl2" || version === "auto") {
gl = canvas.getContext("webgl2", opts);
}
if (!gl && (version === "webgl" || version === "auto")) {
gl = canvas.getContext("webgl", opts) || canvas.getContext("webgl-experimental", opts) || canvas.getContext("experimental-webgl", opts);
}
return gl;
};
var _default = exports.default = getContext;
//# sourceMappingURL=getContext.js.map