summaryrefslogtreecommitdiffstats
path: root/o3d/samples/o3d-webgl/bitmap.js
diff options
context:
space:
mode:
authorpetersont@google.com <petersont@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-12 21:00:00 +0000
committerpetersont@google.com <petersont@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-12 21:00:00 +0000
commite512583b79e366db399a6566964412bb6e5af823 (patch)
treee15e3c05e273a0366caf2fcbc5689ae377b3e877 /o3d/samples/o3d-webgl/bitmap.js
parenta37a999f87eed77b08e7e1b6bdb86d406f31ea9b (diff)
downloadchromium_src-e512583b79e366db399a6566964412bb6e5af823.zip
chromium_src-e512583b79e366db399a6566964412bb6e5af823.tar.gz
chromium_src-e512583b79e366db399a6566964412bb6e5af823.tar.bz2
Added textures, texture samplers and render targets to o3d-webgl. Also fixed bugs, added calls to parent class constructor to classes that didn't have them before, added a few demos to exhibit/test textures and render surfaces.
Review URL: http://codereview.chromium.org/856004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41482 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/samples/o3d-webgl/bitmap.js')
-rw-r--r--o3d/samples/o3d-webgl/bitmap.js40
1 files changed, 32 insertions, 8 deletions
diff --git a/o3d/samples/o3d-webgl/bitmap.js b/o3d/samples/o3d-webgl/bitmap.js
index 6ce1df7..5e2fcfc 100644
--- a/o3d/samples/o3d-webgl/bitmap.js
+++ b/o3d/samples/o3d-webgl/bitmap.js
@@ -73,13 +73,20 @@ o3d.Bitmap.IMAGE = 6;
o3d.Bitmap.SLICE = 7;
+/**
+ * In webgl the bitmap object is represented by an offscreen canvas.
+ * @type {Canvas}
+ * @private
+ */
+o3d.Bitmap.prototype.canvas_ = null;
+
/**
* Flips a bitmap vertically in place.
- * @type {boolean}
*/
-o3d.Bitmap.prototype.flipVertically = false;
-
+o3d.Bitmap.prototype.flipVertically = function() {
+ this.defer_flip_vertically_to_texture_ = true;
+};
/**
@@ -94,7 +101,7 @@ o3d.Bitmap.prototype.flipVertically = false;
*/
o3d.Bitmap.prototype.generateMips =
function(source_level, num_levels) {
- o3d.notImplemented();
+ this.defer_mipmaps_to_texture_ = true;
};
@@ -113,12 +120,29 @@ o3d.Bitmap.prototype.width = 0;
o3d.Bitmap.prototype.height = 0;
+/**
+ * Instead of generating mipmaps in the bitmap object, just set this boolean
+ * to true, then the texture will generate mipmaps when it loads the bitmap.
+ * @type {boolean}
+ * @private
+ */
+o3d.Bitmap.prototype.defer_mipmaps_to_texture_ = false;
+
+
+/**
+ * Instead of flipping vertically in the bitmap object, just set this boolean
+ * to true, then the texture will generate mipmaps when it loads the bitmap.
+ * @type {boolean}
+ * @private
+ */
+o3d.Bitmap.prototype.defer_flip_vertically_to_texture_ = false;
+
/**
* The format of the bitmap (read only).
- * @type {number}
+ * @type {!o3d.Texture.Format}
*/
-o3d.Bitmap.prototype.format = 0;
+o3d.Bitmap.prototype.format = o3d.Texture.UNKNOWN_FORMAT;
@@ -132,9 +156,9 @@ o3d.Bitmap.prototype.numMipmaps = 1;
/**
* The Semantic of the bitmap.
- * @type {!o3d.Stream.Semantic}
+ * @type {!o3d.Bitmap.Semantic}
*/
-o3d.Bitmap.prototype.semantic = o3d.Stream.UNKNOWN_SEMANTIC;
+o3d.Bitmap.prototype.semantic = o3d.Bitmap.UNKNOWN_SEMANTIC;