Can anyone who has used three.js tell me if its possible to detect webgl support, and, if not present, fallback to a standard Canvas render?
解决方案
Yes, it's possible. You can use CanvasRenderer instead of WebGLRenderer.
About WebGL detection:
if (!window.WebGLRenderingContext) {
// the browser doesn't even know what WebGL is
window.location = "http://get.webgl.org";
} else {
var canvas = document.getElementById("myCanvas");
var context = canvas.getContext("webgl");
if (!context) {
// browser supports WebGL but initialization failed.
window.location = "http://get.webgl.org/troubleshooting";
}
}
renderer = Detector.webgl? new THREE.WebGLRenderer(): new THREE.CanvasRenderer();