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

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

Issue 3035012: These changes are needed for when we turn on REAL ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/o3d/
Patch Set: '' Created 10 years, 5 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 | « no previous file | samples/o3d-webgl/texture.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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 * @return {bool} Success. 197 * @return {bool} Success.
198 */ 198 */
199 o3d.Effect.prototype.loadShaderFromString = function(shaderString, type) { 199 o3d.Effect.prototype.loadShaderFromString = function(shaderString, type) {
200 if (!this.program_) { 200 if (!this.program_) {
201 this.program_ = this.gl.createProgram(); 201 this.program_ = this.gl.createProgram();
202 } 202 }
203 203
204 var success = true; 204 var success = true;
205 205
206 var shader = this.gl.createShader(type); 206 var shader = this.gl.createShader(type);
207 this.gl.shaderSource(shader, shaderString); 207 this.gl.shaderSource(
208 shader, "#ifdef GL_ES\nprecision highp float;\n#endif\n" + shaderString);
208 this.gl.compileShader(shader); 209 this.gl.compileShader(shader);
209
210 if (!this.gl.getShaderParameter(shader, this.gl.COMPILE_STATUS)) { 210 if (!this.gl.getShaderParameter(shader, this.gl.COMPILE_STATUS)) {
211 success = false; 211 success = false;
212 var log = this.gl.getShaderInfoLog(shader); 212 var log = this.gl.getShaderInfoLog(shader);
213 this.gl.client.error_callback( 213 this.gl.client.error_callback(
214 'Shader compile failed with error log:\n' + log); 214 'Shader compile failed with error log:\n' + log);
215 } 215 }
216 216
217 this.gl.attachShader(this.program_, shader); 217 this.gl.attachShader(this.program_, shader);
218 218
219 return success; 219 return success;
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 * @type {o3d.Effect.MatrixLoadOrder} 619 * @type {o3d.Effect.MatrixLoadOrder}
620 */ 620 */
621 o3d.Effect.prototype.matrix_load_order_ = o3d.Effect.ROW_MAJOR; 621 o3d.Effect.prototype.matrix_load_order_ = o3d.Effect.ROW_MAJOR;
622 622
623 623
624 /** 624 /**
625 * The source for the shaders on this Effect. 625 * The source for the shaders on this Effect.
626 * @type {string} 626 * @type {string}
627 */ 627 */
628 o3d.Effect.prototype.source_ = ''; 628 o3d.Effect.prototype.source_ = '';
OLDNEW
« no previous file with comments | « no previous file | samples/o3d-webgl/texture.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698