Proper try of Cesium creation, error catching, cross browser compatibility and developer errors.

Hi,

In my Cesium-based app (it has a 2D fallback like yours, Leaflet in my case), we use this check to determine if WebGL is supported:

https://github.com/TerriaJS/terriajs/blob/master/lib/viewer/AusGlobeViewer.js#L673

I haven’t seen the Cesium.Viewer fail to be constructed after passing this check, although I’m sure some horribly broken WebGL implementation somewhere might fail in that way.

We also catch render loop errors and switch to 2D:

https://github.com/TerriaJS/terriajs/blob/master/lib/Models/Cesium.js#L165

Out of memory errors can be pretty hard to recover from, though. If Cesium is crashing due to being out of memory, you’ll probably need to figure out how to reduce your memory usage, rather than attempt to catch it and recover.

Kevin