WebGL-compatibility-check.html 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <!DOCTYPE html>
  2. <html lang="it">
  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>Controllo compatibilità WebGL ([name])</h1>
  11. <p>
  12. Anche se questo sta diventano sempre meno un problema, alcuni dispositivi o browser potrebbero ancora non supportare WebGL.
  13. Il seguente codice è utile per controllare se WebGL è supportato, infatti se non lo fosse viene mostrato un messaggio di errore all'utente.
  14. </p>
  15. <p>
  16. Aggiungere il seguente link [link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/capabilities/WebGL.js]
  17. al file javascript ed inserire il seguente codice prima di provare a renderizzare qualsiasi cosa:
  18. </p>
  19. <code>
  20. if ( WebGL.isWebGLAvailable() ) {
  21. // Avviare qui la funzione o altre inizializzazioni
  22. animate();
  23. } else {
  24. const warning = WebGL.getWebGLErrorMessage();
  25. document.getElementById( 'container' ).appendChild( warning );
  26. }
  27. </code>
  28. </body>
  29. </html>