You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
1014 B
31 lines
1014 B
<!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/capabilities/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>
|
|
|