diff --git a/src/webgldrawer.js b/src/webgldrawer.js index 1ea3fa38..309d247b 100644 --- a/src/webgldrawer.js +++ b/src/webgldrawer.js @@ -90,6 +90,10 @@ this.context = this._outputContext; // API required by tests + // for use with qunit tests + this._numGlMaxTextureErrors = 0; + this._numGlMaxTextureOks = 0; + } // Public API required by all Drawer implementations @@ -274,6 +278,14 @@ } let maxTextures = this._gl.getParameter(this._gl.MAX_TEXTURE_IMAGE_UNITS); + if(maxTextures <= 0){ + this._numGlMaxTextureErrors += 1; + $.console.error(`There was a WebGL problem: bad value for MAX_TEXTURE_IMAGE_UNITS (${maxTextures})`); + console.error(`There was a WebGL problem: bad value for MAX_TEXTURE_IMAGE_UNITS (${maxTextures})`); + return; + } else { + this._numGlMaxTextureOks += 1; + } let texturePositionArray = new Float32Array(maxTextures * 12); // 6 vertices (2 triangles) x 2 coordinates per vertex let textureDataArray = new Array(maxTextures); let matrixArray = new Array(maxTextures); diff --git a/test/modules/ajax-tiles.js b/test/modules/ajax-tiles.js index f55c1e31..fc0b0545 100644 --- a/test/modules/ajax-tiles.js +++ b/test/modules/ajax-tiles.js @@ -54,9 +54,8 @@ }, afterEach: function() { if (viewer){ - - viewer.destroy(); - } + viewer.destroy(); + } viewer = null; } diff --git a/test/modules/basic.js b/test/modules/basic.js index 24f6a7e7..bf2fc077 100644 --- a/test/modules/basic.js +++ b/test/modules/basic.js @@ -17,9 +17,8 @@ }, afterEach: function () { if (viewer){ - - viewer.destroy(); - } + viewer.destroy(); + } viewer = null; } diff --git a/test/modules/drawer.js b/test/modules/drawer.js index c911838e..e7b8e8cf 100644 --- a/test/modules/drawer.js +++ b/test/modules/drawer.js @@ -15,10 +15,6 @@ }, afterEach: function () { if (viewer){ - let errors = viewer.drawer._numGlMaxTextureErrors; - if(errors > 0){ - console.log('Number of times MAX_TEXTURE_IMAGE_UNITS had a bad value:', errors); - } else { console.log('Num OK draw calls', viewer.drawer._numGlMaxTextureOks); } viewer.destroy(); } viewer = null; diff --git a/test/modules/viewport.js b/test/modules/viewport.js index 2fbe50b0..995447bd 100644 --- a/test/modules/viewport.js +++ b/test/modules/viewport.js @@ -22,9 +22,8 @@ }, afterEach: function () { if (viewer){ - - viewer.destroy(); - } + viewer.destroy(); + } viewer = null; }