WebGL-compatibility-check.html 976 B

12345678910111213141516171819202122232425262728293031323334
  1. <!DOCTYPE html>
  2. <html lang="pt-br">
  3. <head>
  4. <meta charset="utf-8">
  5. <base href="../../../" />
  6. <script src="page.js"></script>
  7. <link type="text/css" rel="stylesheet" href="page.css" />
  8. </head>
  9. <body>
  10. <h1>Compatibilidade WebGL</h1>
  11. <p>
  12. Mesmo que isso esteja se tornando um problema cada vez menor, alguns dispositivos ou navegadores podem ainda não suportar WebGL. O método a seguir permite verificar se há suporte e exibe uma mensagem para o usuário se não existir.
  13. </p>
  14. <p>
  15. Adicione [link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/capabilities/WebGL.js] ao seu JavaScript e execute o seguinte código antes de tentar renderizar qualquer coisa.
  16. </p>
  17. <code>
  18. if ( WebGL.isWebGLAvailable() ) {
  19. // Initiate function or other initializations here
  20. animate();
  21. } else {
  22. const warning = WebGL.getWebGLErrorMessage();
  23. document.getElementById( 'container' ).appendChild( warning );
  24. }
  25. </code>
  26. </body>
  27. </html>