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);
}