diff options
author | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-27 00:16:16 +0000 |
---|---|---|
committer | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-27 00:16:16 +0000 |
commit | b258a28d04f488a8985159702ceed3c1b9913d3b (patch) | |
tree | 88b3b00bf7f63478cedcfa9802c41ecac196d0be /o3d | |
parent | 63938b535e41098cb510ee62cd0e284358ba9618 (diff) | |
download | chromium_src-b258a28d04f488a8985159702ceed3c1b9913d3b.zip chromium_src-b258a28d04f488a8985159702ceed3c1b9913d3b.tar.gz chromium_src-b258a28d04f488a8985159702ceed3c1b9913d3b.tar.bz2 |
Fix a few minor issues.
1 is that Client objects are added to the
global list of clients before they are ready.
I just added a check that they are ready with
if (this.gl) although we could change the code
so they don't get added in the constructor
but instead in initWithCanvas.
Also added "webgl" as a context name.
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/3164044
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57613 0039d316-1c4b-4281-b951-d872f2087c98
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) { |