Detects WebGL and browser compatibility when using Three.js (detecting WebGL and browser compatibility with Three.js)
The beautiful Life of the Sun Vulcan (http://blog.csdn.net/opengl_es)
This article follows "Attribution-non-commercial use-consistent" authoring public agreement
Reprint Please keep this sentence: Sun Vulcan's Beautiful Life-this blog focuses on Agile development and mobile and IoT device research: IOS, Android, HTML5, Arduino, Pcduino , Otherwise, the article from this blog refused to reprint or re-reproduced, thank you for your cooperation.
Detecting WebGL and browser compatibility when using Three.js
(Detecting WebGL and browser compatibility with Three.js) Ubershmekel edited this pageOn Nov· 2 Revisions
Problems encountered
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 support Ed.
A solution
A Solution
in order to detect WEBGL compatibility and gracefully inform the user 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);}
Related Resources
Resources
Http://stackoverflow.com/questions/8312546/support-of-canvas-and-webgl-three-js-on-moble-devices https:// github.com/mrdoob/three.js/issues/257