diff options
Diffstat (limited to 'o3d')
-rw-r--r-- | o3d/samples/o3d-webgl/client.js | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/o3d/samples/o3d-webgl/client.js b/o3d/samples/o3d-webgl/client.js index d003701..3706958 100644 --- a/o3d/samples/o3d-webgl/client.js +++ b/o3d/samples/o3d-webgl/client.js @@ -455,6 +455,9 @@ o3d.Client.prototype.renderMode = o3d.Client.RENDERMODE_CONTINUOUS; * RENDERMODE_ON_DEMAND. */ o3d.Client.prototype.render = function() { + if (!this.gl) { + return; + } // Synthesize a render event. var render_event = new o3d.RenderEvent; this.counter_manager_.advanceRenderFrameCounters(); @@ -648,13 +651,15 @@ o3d.Client.prototype.initWithCanvas = function(canvas) { if (!canvas || !canvas.getContext) { return false; } - try { - gl = canvas.getContext("experimental-webgl", standard_attributes) - } catch(e) { } - if (!gl) { + + var names = ["webgl", "experimental-webgl", "moz-webgl"]; + for (var ii = 0; ii < names.length; ++ii) { try { - gl = canvas.getContext("moz-webgl") + gl = canvas.getContext(names[ii], standard_attributes) } catch(e) { } + if (gl) { + break; + } } if (!gl) { |