diff --git a/src/ol/webgl/map.js b/src/ol/webgl/map.js index 0b1a080f30..421b0ea09d 100644 --- a/src/ol/webgl/map.js +++ b/src/ol/webgl/map.js @@ -14,6 +14,12 @@ goog.require('ol.webgl.shader.Fragment'); goog.require('ol.webgl.shader.Vertex'); +/** + * @define {boolean} Enable WebGL debugging. + */ +ol.DEBUG_WEBGL = false; + + /** * @enum {string} */ @@ -57,6 +63,10 @@ ol.webgl.Map = function(target, opt_values) { }); goog.asserts.assert(!goog.isNull(this.gl_)); + if (ol.DEBUG_WEBGL) { + this.gl_ = WebGLDebugUtils.makeDebugContext(this.gl_); + } + goog.events.listen(this.canvas_, ol.webgl.WebGLContextEventType.LOST, this.handleWebGLContextLost, false, this); goog.events.listen(this.canvas_, ol.webgl.WebGLContextEventType.RESTORED,