three.js

three.js笔记 之 WebGL兼容性检测

2021-02-25  本文已影响0人  伶念

https://github.com/mrdoob/three.js/blob/master/examples/jsm/WebGL.js引入到你的文件,并在尝试开始渲染之前先运行该文件。

if (WEBGL.isWebGLAvailable()) {
    // Initiate function or other initializations here
    animate();
} else {
    const warning = WEBGL.getWebGLErrorMessage();
    document.getElementById('container').appendChild(warning);
}
上一篇下一篇

猜你喜欢

热点阅读