| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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_ = ''; |
| OLD | NEW |