summaryrefslogtreecommitdiffstats
path: root/o3d/samples/o3d-webgl
diff options
context:
space:
mode:
authorgman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-26 23:12:35 +0000
committergman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-26 23:12:35 +0000
commit3956cf7c87681860d93d828846abe612f80b2263 (patch)
tree3ceec20cf7374b9e19afdaa86f74c452a1bde974 /o3d/samples/o3d-webgl
parent3fde3b334dbbb77197552c22bfc174f7d8aba407 (diff)
downloadchromium_src-3956cf7c87681860d93d828846abe612f80b2263.zip
chromium_src-3956cf7c87681860d93d828846abe612f80b2263.tar.gz
chromium_src-3956cf7c87681860d93d828846abe612f80b2263.tar.bz2
Change the URL for when there is no WebGL
There is an "official" url now. Over time it is supposed to be updated to auto redirect depending on the browser so Firefox would redirect to a Firefox upgrade page, Safari to a Safari upgrade page etc.. Also, make o3d-webgl run in IE6/7/8/9 at least to the point that it comes up with the message to get a browser that supports WebGL Also also note: There a 3 or more cases that need to be covered for WebGL apps Case #1: canvas doesn't exist at all. (IE6/7/8) Case #2: canvas does exist but there's no WebGL Case #3: canvas does exist, WebGL exists and should run but can't. (ie, don't tell the user to get new browser in this case) WebGL is being updated to give info so case #3 can be handled so we can update o3d-webgl when that's available. TEST=none BUG=none Review URL: http://codereview.chromium.org/3204014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57603 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/samples/o3d-webgl')
-rw-r--r--o3d/samples/o3d-webgl/base.js11
-rw-r--r--o3d/samples/o3d-webgl/buffer.js16
2 files changed, 21 insertions, 6 deletions
diff --git a/o3d/samples/o3d-webgl/base.js b/o3d/samples/o3d-webgl/base.js
index c9876be..b484e484 100644
--- a/o3d/samples/o3d-webgl/base.js
+++ b/o3d/samples/o3d-webgl/base.js
@@ -77,6 +77,17 @@ o3d.global = this;
o3d.basePath = '';
/**
+ * Some javascripts don't support __defineGetter__ or __defineSetter__
+ * so we define some here so at least we don't get compile errors.
+ * We expect the initialzation code will check and complain. This stubs
+ * are just here to make sure we can actually get to the initialization code.
+ */
+if (!Object.prototype.__defineSetter__) {
+ Object.prototype.__defineSetter__ = function() {}
+ Object.prototype.__defineGetter__ = function() {}
+}
+
+/**
* Tries to detect the base path of the base.js script that
* bootstraps the o3d libraries.
* @private
diff --git a/o3d/samples/o3d-webgl/buffer.js b/o3d/samples/o3d-webgl/buffer.js
index 8f4e65e..f8dad1a 100644
--- a/o3d/samples/o3d-webgl/buffer.js
+++ b/o3d/samples/o3d-webgl/buffer.js
@@ -63,10 +63,13 @@ o3d.Buffer.prototype.totalComponents = 0;
o3d.Buffer.prototype.gl_buffer_ = 0;
/**
- * Type of the array element.
- * @type {!Float32Array}
+ * Function to create an array for the buffer.
+ * @param {number} numElements
+ * @return {!Float32Array}
*/
-o3d.Buffer.prototype.ArrayType = Float32Array;
+o3d.Buffer.prototype.createArray = function(numElements) {
+ return new Float32Array(numElements);
+};
o3d.Buffer.prototype.__defineGetter__('numElements',
function() {
@@ -108,7 +111,7 @@ o3d.Buffer.prototype.resize = function(numElements) {
this.gl_buffer_ = this.gl.createBuffer();
// Callers (in particular the deserializer) occasionally call this
// with floating-point numbers.
- this.array_ = new this.ArrayType(Math.floor(numElements));
+ this.array_ = this.createArray(Math.floor(numElements));
};
/**
@@ -320,8 +323,9 @@ o3d.inherit('IndexBuffer', 'Buffer');
* Type of the array element.
* @type {!Uint16Array}
*/
-o3d.IndexBuffer.prototype.ArrayType = Uint16Array;
-
+o3d.IndexBuffer.prototype.createArray = function(numElements) {
+ return new Uint16Array(numElements);
+};
/**
* Delivers the buffer to the graphics hardware when read/write is finished.