Use the ol.DEBUG_WEBGL flag to debug shader sources

This commit is contained in:
Tim Schaub
2017-01-16 16:47:04 -07:00
parent 6f7eb53c38
commit fcb9dafc33
10 changed files with 161 additions and 74 deletions
+10 -5
View File
@@ -5,7 +5,6 @@ goog.require('ol');
goog.require('ol.webgl.Fragment');
goog.require('ol.webgl.Vertex');
if (ol.ENABLE_WEBGL) {
/**
@@ -37,7 +36,9 @@ if (ol.ENABLE_WEBGL) {
* @const
* @type {string}
*/
{{className}}.Fragment.SOURCE = {{className}}.Fragment.OPTIMIZED_SOURCE;
{{className}}.Fragment.SOURCE = ol.DEBUG_WEBGL ?
{{className}}.Fragment.DEBUG_SOURCE :
{{className}}.Fragment.OPTIMIZED_SOURCE;
{{className}}.fragment = new {{className}}.Fragment();
@@ -72,7 +73,9 @@ if (ol.ENABLE_WEBGL) {
* @const
* @type {string}
*/
{{className}}.Vertex.SOURCE = {{className}}.Vertex.OPTIMIZED_SOURCE;
{{className}}.Vertex.SOURCE = ol.DEBUG_WEBGL ?
{{className}}.Vertex.DEBUG_SOURCE :
{{className}}.Vertex.OPTIMIZED_SOURCE;
{{className}}.vertex = new {{className}}.Vertex();
@@ -90,14 +93,16 @@ if (ol.ENABLE_WEBGL) {
/**
* @type {WebGLUniformLocation}
*/
this.{{originalName}} = gl.getUniformLocation(program, '{{shortName}}');
this.{{originalName}} = gl.getUniformLocation(
program, ol.DEBUG_WEBGL ? '{{originalName}}' : '{{shortName}}');
{{/getUniforms}}
{{#getAttributes}}
/**
* @type {number}
*/
this.{{originalName}} = gl.getAttribLocation(program, '{{shortName}}');
this.{{originalName}} = gl.getAttribLocation(
program, ol.DEBUG_WEBGL ? '{{originalName}}' : '{{shortName}}');
{{/getAttributes}}
};