madiator.com/ui/component/viewers/threeViewer/internal/detector.js

11 lines
351 B
JavaScript
Raw Normal View History

2021-08-16 12:11:25 +02:00
const detectWebGL = () => {
// Create canvas element.
const canvas = document.createElement('canvas');
// Get WebGLRenderingContext from canvas element.
const gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl');
// Return the result.
return gl && gl instanceof WebGLRenderingContext;
};
export default detectWebGL;