From 40c33a21eb65c5b9d79f78fa837b16eda22bd8ad Mon Sep 17 00:00:00 2001 From: tsauerwein Date: Thu, 20 Nov 2014 12:28:49 +0100 Subject: [PATCH 1/2] Mark ol.has.WEBGL_MAX_TEXTURE_SIZE as API --- src/ol/has.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ol/has.js b/src/ol/has.js index ed05a84f85..1c6b36a7f5 100644 --- a/src/ol/has.js +++ b/src/ol/has.js @@ -127,6 +127,7 @@ ol.has.WEBGL; * supported, the value is set to `-1`. * @const * @type {number} + * @api */ ol.has.WEBGL_MAX_TEXTURE_SIZE; From 8fcde092c75b9120ea396c5db6c1fb4309fe06ec Mon Sep 17 00:00:00 2001 From: tsauerwein Date: Thu, 20 Nov 2014 15:07:13 +0100 Subject: [PATCH 2/2] Set the default of WEBGL_MAX_TEXTURE_SIZE to undefined By doing so the examples will also work if WebGL is not supported. --- examples/symbol-atlas-webgl.js | 3 ++- src/ol/has.js | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/examples/symbol-atlas-webgl.js b/examples/symbol-atlas-webgl.js index 8042dedf42..63dd568bb3 100644 --- a/examples/symbol-atlas-webgl.js +++ b/examples/symbol-atlas-webgl.js @@ -15,7 +15,8 @@ var atlasManager = new ol.style.AtlasManager({ // we increase the default size so that all symbols fit into // a single atlas image size: 512, - maxSize: ol.has.WEBGL_MAX_TEXTURE_SIZE}); + maxSize: ol.has.WEBGL_MAX_TEXTURE_SIZE +}); var symbolInfo = [{ opacity: 1.0, diff --git a/src/ol/has.js b/src/ol/has.js index 1c6b36a7f5..720977cef4 100644 --- a/src/ol/has.js +++ b/src/ol/has.js @@ -124,9 +124,9 @@ ol.has.WEBGL; /** * The maximum supported WebGL texture size in pixels. If WebGL is not - * supported, the value is set to `-1`. + * supported, the value is set to `undefined`. * @const - * @type {number} + * @type {number|undefined} * @api */ ol.has.WEBGL_MAX_TEXTURE_SIZE; @@ -143,8 +143,9 @@ ol.has.WEBGL_EXTENSIONS; (function() { if (ol.ENABLE_WEBGL) { var hasWebGL = false; - var textureSize = -1; + var textureSize; var /** @type {Array.} */ extensions = []; + if ('WebGLRenderingContext' in goog.global) { try { var canvas = /** @type {HTMLCanvasElement} */