Files
apt-nl-map/static/Magic4/js/three.js-dev/docs/manual/zh/introduction/WebGL-compatibility-check.html

32 lines
1001 B
HTML
Raw Normal View History

2024-12-04 10:21:04 +08:00
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8">
<base href="../../../" />
<script src="page.js"></script>
<link type="text/css" rel="stylesheet" href="page.css" />
</head>
<body>
<h1>WebGL兼容性检查[name]</h1>
<p>
虽然这个问题现在已经变得越来不明显但不可否定的是某些设备以及浏览器直到现在仍然不支持WebGL。<br>以下的方法可以帮助你检测当前用户所使用的环境是否支持WebGL如果不支持将会向用户提示一条信息。
</p>
<p>
请将[link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/WebGL.js]引入到你的文件,并在尝试开始渲染之前先运行该文件。
</p>
<code>
if (WEBGL.isWebGLAvailable()) {
// Initiate function or other initializations here
animate();
} else {
const warning = WEBGL.getWebGLErrorMessage();
document.getElementById('container').appendChild(warning);
}
</code>
</body>
</html>