Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(237)

Side by Side Diff: samples/o3d-webgl/pack.js

Issue 1092003: Fixed a lot of bugs with render surfaces and bitmaps. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/o3d/
Patch Set: '' Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « samples/o3d-webgl/effect.js ('k') | samples/o3d-webgl/param.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2010, Google Inc. 2 * Copyright 2010, Google Inc.
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 * @return {!o3d.Texture2D} The Texture2D object. 199 * @return {!o3d.Texture2D} The Texture2D object.
200 */ 200 */
201 o3d.Pack.prototype.createTexture2D = 201 o3d.Pack.prototype.createTexture2D =
202 function(width, height, format, levels, enable_render_surfaces) { 202 function(width, height, format, levels, enable_render_surfaces) {
203 var texture = this.createObject('Texture2D'); 203 var texture = this.createObject('Texture2D');
204 texture.width = width; 204 texture.width = width;
205 texture.height = height; 205 texture.height = height;
206 texture.levels = levels; 206 texture.levels = levels;
207 texture.texture_ = this.gl.createTexture(); 207 texture.texture_ = this.gl.createTexture();
208 208
209 if (enable_render_surfaces) { 209 if (width != undefined && height != undefined) {
210 this.gl.bindTexture(this.gl.TEXTURE_2D, texture.texture_); 210 this.gl.bindTexture(this.gl.TEXTURE_2D, texture.texture_);
211 this.gl.texImage2D(this.gl.TEXTURE_2D, 0, this.gl.RGBA, width, height, 211 this.gl.texImage2D(this.gl.TEXTURE_2D, 0, this.gl.RGBA, width, height,
212 0, this.gl.RGBA, this.gl.UNSIGNED_BYTE, null); 212 0, this.gl.RGBA, this.gl.UNSIGNED_BYTE, null);
213 }
213 214
214 this.gl.texParameteri(this.gl.TEXTURE_2D, 215 this.gl.bindTexture(this.gl.TEXTURE_2D, texture.texture_);
215 this.gl.TEXTURE_MAG_FILTER, this.gl.LINEAR); 216 this.gl.texParameteri(this.gl.TEXTURE_2D,
216 this.gl.texParameteri(this.gl.TEXTURE_2D, 217 this.gl.TEXTURE_MAG_FILTER, this.gl.LINEAR);
217 this.gl.TEXTURE_MIN_FILTER, this.gl.LINEAR); 218 this.gl.texParameteri(this.gl.TEXTURE_2D,
218 this.gl.texParameteri(this.gl.TEXTURE_2D, 219 this.gl.TEXTURE_MIN_FILTER, this.gl.LINEAR);
219 this.gl.TEXTURE_WRAP_S, this.gl.CLAMP_TO_EDGE); 220 this.gl.texParameteri(this.gl.TEXTURE_2D,
220 this.gl.texParameteri(this.gl.TEXTURE_2D, 221 this.gl.TEXTURE_WRAP_S, this.gl.CLAMP_TO_EDGE);
221 this.gl.TEXTURE_WRAP_T, this.gl.CLAMP_TO_EDGE); 222 this.gl.texParameteri(this.gl.TEXTURE_2D,
222 } 223 this.gl.TEXTURE_WRAP_T, this.gl.CLAMP_TO_EDGE);
223 224
224 return texture; 225 return texture;
225 }; 226 };
226 227
227 228
228 /** 229 /**
229 * Creates a new TextureCUBE object of the specified size and format and 230 * Creates a new TextureCUBE object of the specified size and format and
230 * reserves the necessary resources for it. 231 * reserves the necessary resources for it.
231 * Note: If enable_render_surfaces is true, then the dimensions must be a 232 * Note: If enable_render_surfaces is true, then the dimensions must be a
232 * power of two. 233 * power of two.
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 /** 393 /**
393 * Create RawData given a data URL. 394 * Create RawData given a data URL.
394 * @param {string} data_url The data URL from which to create the RawData. 395 * @param {string} data_url The data URL from which to create the RawData.
395 * @return {!o3d.RawData} The RawData. 396 * @return {!o3d.RawData} The RawData.
396 */ 397 */
397 o3d.Pack.prototype.createRawDataFromDataURL = 398 o3d.Pack.prototype.createRawDataFromDataURL =
398 function(data_url) { 399 function(data_url) {
399 o3d.notImplemented(); 400 o3d.notImplemented();
400 }; 401 };
401 402
OLDNEW
« no previous file with comments | « samples/o3d-webgl/effect.js ('k') | samples/o3d-webgl/param.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698