diff options
Diffstat (limited to 'apps/samples/vrml')
-rw-r--r-- | apps/samples/vrml/viewer-webgl.js | 25 | ||||
-rw-r--r-- | apps/samples/vrml/viewer.html | 6 |
2 files changed, 28 insertions, 3 deletions
diff --git a/apps/samples/vrml/viewer-webgl.js b/apps/samples/vrml/viewer-webgl.js index 5f8a4e8..5cec6e6 100644 --- a/apps/samples/vrml/viewer-webgl.js +++ b/apps/samples/vrml/viewer-webgl.js @@ -55,6 +55,31 @@ function VRMLViewer(element, params) { } } + var hasWebGL = function() { + try { + if (!window.WebGLRenderingContext) { + return false; + } + var canvas = document.createElement("canvas"); + var names = ["webgl", "experimental-webgl", "moz-webgl", "webkit-3d"]; + for (var i = 0; i < 4; i++) { + var gl = canvas.getContext(names[i]); + if (gl) { + return true; + } + } + } catch(e) { + return false; + } + return false; + } + + if (self.enableWebGL && !hasWebGL()) { + console.log("Your browser does no support WebGL, falling back to sceneshots"); + self.enableWebGL = false; + self.enableSceneshots = true; + } + // normalize parameters var normalizeParams = function() { // make sure server url begins with protocol and does *not* ends in / diff --git a/apps/samples/vrml/viewer.html b/apps/samples/vrml/viewer.html index 7357ee4..873da0e 100644 --- a/apps/samples/vrml/viewer.html +++ b/apps/samples/vrml/viewer.html @@ -75,9 +75,9 @@ }, enableMovies: false, enableDND: false, - enableWebGL: false, - enableSceneshots: true, - enableDraggables: true, + enableWebGL: true, + enableSceneshots: false, + enableDraggables: false, listNavigationStyle: true, treeNavigationStyle: true, listDirectory: "/hard_mp", |