Skip to content

Instantly share code, notes, and snippets.

@faridiot
Created July 10, 2016 02:47
Show Gist options
  • Save faridiot/cbe4c249d6dddf265bca3ddda26fbacb to your computer and use it in GitHub Desktop.
Save faridiot/cbe4c249d6dddf265bca3ddda26fbacb to your computer and use it in GitHub Desktop.

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 add https://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);
}		

Resources

http://stackoverflow.com/questions/8312546/support-of-canvas-and-webgl-three-js-on-moble-devices mrdoob/three.js#257

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment