From d7add76b3740b92fb94deff2fb812b6a9bcd617c Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Thu, 19 Apr 2012 16:07:45 -0400 Subject: [PATCH] Improved error handling. --- src/js/pannellum.js | 32 +++++++++++++++++--------------- src/pannellum.htm | 2 +- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/js/pannellum.js b/src/js/pannellum.js index adaa460..0bea2cf 100644 --- a/src/js/pannellum.js +++ b/src/js/pannellum.js @@ -90,28 +90,30 @@ function init() panotexture.needsUpdate = true; mesh = new THREE.Mesh(new THREE.Sphere(500,60,40), new THREE.MeshBasicMaterial({map:panotexture})); mesh.scale.x = -1; - //try - //{ + try + { scene.addObject(mesh); - //} - //catch (event) - //{ - // // show error message if canvas is not supported - // document.getElementById('nocanvas').style.display = 'table'; - //} + } + catch (event) + { + // show error message if canvas is not supported + load_box.style.display = 'none'; + document.getElementById('nocanvas').style.display = 'table'; + } // try to use WebGL, else fallback to 2D canvas - //try - //{ + try + { renderer = new THREE.WebGLRenderer(); renderer.setSize(window.innerWidth,window.innerHeight); renderer.initWebGLObjects(scene); - //} - /*catch (event) + } + catch (event) { - renderer = new THREE.CanvasRenderer(); - renderer.setSize(window.innerWidth,window.innerHeight); - }*/ + // show error message if WebGl is not supported + load_box.style.display = 'none'; + document.getElementById('nocanvas').style.display = 'table'; + } container.appendChild(renderer.domElement); diff --git a/src/pannellum.htm b/src/pannellum.htm index f6b6bce..3a41c0e 100644 --- a/src/pannellum.htm +++ b/src/pannellum.htm @@ -33,7 +33,7 @@

Load
Panorama

-

A browser supporting the canvas element (and WebGL) is required to view this panorama.

+

A browser supporting WebGL (and the canvas element) is required to view this panorama.

http://pannellum.sf.net/

Licensing:
GNU LGPL v2.1