Android教程網
  1. 首頁
  2. Android 技術
  3. Android 手機
  4. Android 系統教程
  5. Android 游戲
 Android教程網 >> Android技術 >> 關於Android編程 >> Threejs 官網 - 檢測使用 three.js 時的 WebGL 和浏覽器兼容性(Detecting WebGL and browser compatibility with three.js)

Threejs 官網 - 檢測使用 three.js 時的 WebGL 和浏覽器兼容性(Detecting WebGL and browser compatibility with three.js)

編輯:關於Android編程

 

 

 

檢測使用 three.js 時的 WebGL 和浏覽器兼容性
(Detecting WebGL and browser compatibility with three.js)

ubershmekel edited this page · 2 revisions

 

 

 

遇到的問題
The problem

 

Not all browsers support WebGL, in fact only chrome and firefox work with three.js WebGLRenderer currently. iOS works with the canvas renderer and although IE9 supports canvas, it doesn't support workers so currently isn't supported.

 

一種解決方案
A solution

In order to detect webgl compatibility and gracefully inform the user you can addhttps://github.com/mrdoob/three.js/blob/master/examples/js/Detector.js to your javascript and use this example to avoid even attempting to render anything:

if (Detector.webgl) {
    init();
    animate();
} else {
    var warning = Detector.getWebGLErrorMessage();
    document.getElementById('container').appendChild(warning);
}       

 

 

 

 

 

 

 

  1. 上一頁:
  2. 下一頁:
熱門文章
閱讀排行版
Copyright © Android教程網 All Rights Reserved