WebGL-compatibility-check.html 1002 B

123456789101112131415161718192021222324252627282930313233
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <base href="../../../" />
  6. <script src="list.js"></script>
  7. <script src="page.js"></script>
  8. <link type="text/css" rel="stylesheet" href="page.css" />
  9. </head>
  10. <body>
  11. <h1>[name]</h1><br />
  12. <p>
  13. 虽然这个问题现在已经变得越来越小,但不得不说,有的设备或者浏览器到现在仍然不支持WebGL。
  14. 以下的方法可以帮助你检测当前用户所使用的环境是否支持WebGL,倘若不支持,将向用户显示一条信息。
  15. </p>
  16. <p>
  17. 请把[link:https://github.com/mrdoob/three.js/blob/master/examples/js/Detector.js]引入到你的文件,并在尝试开始渲染之前先运行该文件。
  18. </p>
  19. <code>
  20. if (Detector.webgl) {
  21. // Initiate function or other initializations here
  22. animate();
  23. } else {
  24. var warning = Detector.getWebGLErrorMessage();
  25. document.getElementById('container').appendChild(warning);
  26. }
  27. </code>
  28. </body>
  29. </html>