WebGL.html 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>WebGL - Three.js Docs</title>
  6. <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  7. <script src="../scripts/highlight.min.js"></script>
  8. <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
  9. <link type="text/css" rel="stylesheet" href="../styles/page.css">
  10. </head>
  11. <body>
  12. <h1 translate="no">WebGL</h1>
  13. <section>
  14. <header>
  15. <div class="class-description"><p>A utility module with basic WebGL 2 capability testing.</p></div>
  16. </header>
  17. <article>
  18. <h2 class="subsection-title">Import</h2>
  19. <p><span translate="no">WebGL</span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#en/installation" target="_blank" rel="noopener">Installation#Addons</a>.</p>
  20. <pre><code class="language-js">import WebGL from 'three/addons/capabilities/WebGL.js';</code></pre>
  21. <div class="container-overview">
  22. <div class="method">
  23. </div>
  24. </div>
  25. <h2 class="subsection-title">Static Methods</h2>
  26. <h3 class="name name-method" id=".getWebGL2ErrorMessage" translate="no">.<a href="#.getWebGL2ErrorMessage">getWebGL2ErrorMessage</a><span class="signature">()</span><span class="type-signature"> : HTMLDivElement</span> </h3>
  27. <div class="method">
  28. <div class="description">
  29. <p>Returns a <code>div</code> element representing a formatted error message that can be appended in
  30. web sites if WebGL 2 isn't supported.</p>
  31. </div>
  32. <dl class="details">
  33. <dt class="tag-returns"><strong>Returns:</strong> A <code>div</code> element representing a formatted error message that WebGL 2 isn't supported.</dt>
  34. </dl>
  35. </div>
  36. <h3 class="name name-method" id=".isColorSpaceAvailable" translate="no">.<a href="#.isColorSpaceAvailable">isColorSpaceAvailable</a><span class="signature">( colorSpace : <span class="param-type">string</span> )</span><span class="type-signature"> : boolean</span> </h3>
  37. <div class="method">
  38. <div class="description">
  39. <p>Returns <code>true</code> if the given color space is available. This method can only be used
  40. if WebGL 2 is supported.</p>
  41. </div>
  42. <table class="params">
  43. <tbody>
  44. <tr>
  45. <td class="name">
  46. <strong>colorSpace</strong>
  47. </td>
  48. <td class="description last">
  49. <p>The color space to test.</p>
  50. </td>
  51. </tr>
  52. </tbody>
  53. </table>
  54. <dl class="details">
  55. <dt class="tag-returns"><strong>Returns:</strong> Whether the given color space is available or not.</dt>
  56. </dl>
  57. </div>
  58. <h3 class="name name-method" id=".isWebGL2Available" translate="no">.<a href="#.isWebGL2Available">isWebGL2Available</a><span class="signature">()</span><span class="type-signature"> : boolean</span> </h3>
  59. <div class="method">
  60. <div class="description">
  61. <p>Returns <code>true</code> if WebGL 2 is available.</p>
  62. </div>
  63. <dl class="details">
  64. <dt class="tag-returns"><strong>Returns:</strong> Whether WebGL 2 is available or not.</dt>
  65. </dl>
  66. </div>
  67. <h2 class="subsection-title">Source</h2>
  68. <p>
  69. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/capabilities/WebGL.js" translate="no" target="_blank" rel="noopener">examples/jsm/capabilities/WebGL.js</a>
  70. </p>
  71. </article>
  72. </section>
  73. <script src="../scripts/linenumber.js"></script>
  74. <script src="../scripts/page.js"></script>
  75. </body>
  76. </html>
粤ICP备19079148号