Use OES_element_index_uint when available

This commit is contained in:
Éric Lemoine
2014-11-20 13:40:23 +01:00
parent c564a0963c
commit 2f7c97f25a
3 changed files with 48 additions and 10 deletions

View File

@@ -113,6 +113,15 @@ ol.has.POINTER = 'PointerEvent' in goog.global;
ol.has.MSPOINTER = !!(goog.global.navigator.msPointerEnabled);
/**
* True if browser supports WebGL.
* @const
* @type {boolean}
* @api stable
*/
ol.has.WEBGL;
/**
* The maximum supported WebGL texture size in pixels. If WebGL is not
* supported, the value is set to `-1`.
@@ -123,17 +132,18 @@ ol.has.WEBGL_MAX_TEXTURE_SIZE;
/**
* True if browser supports WebGL.
* List of supported WebGL extensions.
* @const
* @type {boolean}
* @api stable
* @type {Array.<string>}
*/
ol.has.WEBGL;
ol.has.WEBGL_EXTENSIONS;
(function() {
if (ol.ENABLE_WEBGL) {
var hasWebGL = false, textureSize = -1;
var hasWebGL = false;
var textureSize = -1;
var /** @type {Array.<string>} */ extensions = [];
if ('WebGLRenderingContext' in goog.global) {
try {
var canvas = /** @type {HTMLCanvasElement} */
@@ -145,10 +155,12 @@ ol.has.WEBGL;
hasWebGL = true;
textureSize = /** @type {number} */
(gl.getParameter(gl.MAX_TEXTURE_SIZE));
extensions = gl.getSupportedExtensions();
}
} catch (e) {}
}
ol.has.WEBGL = hasWebGL;
ol.has.WEBGL_MAX_TEXTURE_SIZE = textureSize;
ol.has.WEBGL_EXTENSIONS = extensions;
}
})();