summaryrefslogtreecommitdiffstats
path: root/o3d/samples/o3d-webgl/pack.js
diff options
context:
space:
mode:
authorkbr@google.com <kbr@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-23 22:01:10 +0000
committerkbr@google.com <kbr@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-23 22:01:10 +0000
commit1e08646c43e6a02f6dfb69de395f5394097a7fb8 (patch)
tree06773af312b136c7f32973e4aae024f1cf44aeae /o3d/samples/o3d-webgl/pack.js
parent182434efa19ed7aaf0d7ce0b3164003174553cb7 (diff)
downloadchromium_src-1e08646c43e6a02f6dfb69de395f5394097a7fb8.zip
chromium_src-1e08646c43e6a02f6dfb69de395f5394097a7fb8.tar.gz
chromium_src-1e08646c43e6a02f6dfb69de395f5394097a7fb8.tar.bz2
Fixed problem in o3dConverter where it was not outputting all of the
vertex data in JSON format. Fixed problems in effect.js where GLSL code path needed to name the texture coordinate attributes with the semantic names and not the names like "diffuseUV" because otherwise the backend did not know how to hook them up. Fixed problem with cube map faces being flipped and bug in binding cube map textures. At this point o3d-webgl can load the converted cube and teapot, though the teapot is currently missing the bump map. Tested O3D plugin with this sample to ensure no regression. BUG=none TEST=none Review URL: http://codereview.chromium.org/1729012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45495 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/samples/o3d-webgl/pack.js')
-rw-r--r--o3d/samples/o3d-webgl/pack.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/o3d/samples/o3d-webgl/pack.js b/o3d/samples/o3d-webgl/pack.js
index a9f79bb..4a72feb 100644
--- a/o3d/samples/o3d-webgl/pack.js
+++ b/o3d/samples/o3d-webgl/pack.js
@@ -205,6 +205,7 @@ o3d.Pack.prototype.createTexture2D =
texture.height = height;
texture.levels = levels;
texture.texture_ = this.gl.createTexture();
+ texture.texture_target_ = this.gl.TEXTURE_2D;
if (width != undefined && height != undefined) {
this.gl.bindTexture(this.gl.TEXTURE_2D, texture.texture_);
@@ -246,6 +247,7 @@ o3d.Pack.prototype.createTextureCUBE =
var texture = this.createObject('TextureCUBE');
texture.edgeLength = edgeLength;
texture.texture_ = this.gl.createTexture();
+ texture.texture_target_ = this.gl.TEXTURE_CUBE_MAP;
this.gl.bindTexture(this.gl.TEXTURE_CUBE_MAP, texture.texture_);
for (var ii = 0; ii < 6; ++ii) {
@@ -412,15 +414,14 @@ o3d.Pack.prototype.createBitmapsFromRawData =
canvas.width = bitmap.width;
canvas.height = bitmap.height;
-
- bitmap.canvas_ = canvas;
var context = canvas.getContext('2d');
- // Flip it.
- context.translate(0, bitmap.height);
- context.scale(1, -1);
context.drawImage(raw_data.image_,
0, 0, bitmap.width, bitmap.height);
+ bitmap.canvas_ = canvas;
+ // Most images require a vertical flip.
+ bitmap.flipVertically();
+
// TODO(petersont): I'm not sure how to get the format.
bitmap.format = o3d.Texture.ARGB8;
bitmap.numMipmaps = 1;