summaryrefslogtreecommitdiffstats
path: root/o3d/samples/o3d-webgl/texture.js
diff options
context:
space:
mode:
authorkbr@google.com <kbr@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-21 02:30:48 +0000
committerkbr@google.com <kbr@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-21 02:30:48 +0000
commit87b76ac6325a46826d67dca20c351154ad3d94a8 (patch)
tree0337d73c98fff54ec89946bd9f786979daa58552 /o3d/samples/o3d-webgl/texture.js
parent130e036f019117d3341c2a15d06e5004e32c9501 (diff)
downloadchromium_src-87b76ac6325a46826d67dca20c351154ad3d94a8.zip
chromium_src-87b76ac6325a46826d67dca20c351154ad3d94a8.tar.gz
chromium_src-87b76ac6325a46826d67dca20c351154ad3d94a8.tar.bz2
Incremental progress toward archive loading in o3d-webgl. Implemented
ArchiveRequest, which expects to be pointed to the top-level scene.json, and which emulates the behavior of the O3D plugin by downloading the referenced resources and creating RawData objects for each. Pulled in public domain JSON parser from http://www.json.org/ . Implemented portions of TextureCUBE. Fixed some unimplemented functionality and a few bugs related to creation of parameters. At this point a larger refactoring of o3d-webgl is needed to make the deserialization work properly, so this code is being checked in as a checkpoint. Also fixed small bug in the cg_to_glsl converter script. BUG=none TEST=none TBR=petersont,amarinichev Review URL: http://codereview.chromium.org/1745002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45143 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/samples/o3d-webgl/texture.js')
-rw-r--r--o3d/samples/o3d-webgl/texture.js14
1 files changed, 12 insertions, 2 deletions
diff --git a/o3d/samples/o3d-webgl/texture.js b/o3d/samples/o3d-webgl/texture.js
index 90bda54..ce78349 100644
--- a/o3d/samples/o3d-webgl/texture.js
+++ b/o3d/samples/o3d-webgl/texture.js
@@ -376,7 +376,7 @@ o3d.TextureCUBE.FACE_NEGATIVE_Z = 5;
* The length of each edge of the cube, in texels.
* @type {number}
*/
-o3d.TextureCUBE.prototype.edge_length = 0;
+o3d.TextureCUBE.prototype.edgeLength = 0;
/**
@@ -469,7 +469,17 @@ o3d.TextureCUBE.prototype.getRect =
*/
o3d.TextureCUBE.prototype.setFromBitmap =
function(face, bitmap) {
- o3d.notImplemented();
+ this.gl.bindTexture(this.gl.TEXTURE_CUBE_MAP, this.texture_);
+ this.gl.texImage2D(this.gl.TEXTURE_CUBE_MAP_POSITIVE_X + face,
+ 0, // Level.
+ bitmap.canvas_,
+ false); // Do not flip cube maps' faces.
+ // TODO(petersont): figure out when we should call generateMipmaps.
+ // TODO(petersont): move generateMips to Texture2D / TextureCUBE
+ // classes because the target needs to differ.
+ // if (bitmap.defer_mipmaps_to_texture_) {
+ // this.generateMips();
+ // }
};