aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/RDGE/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'js/helper-classes/RDGE/src/core')
-rw-r--r--js/helper-classes/RDGE/src/core/script/renderer.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/js/helper-classes/RDGE/src/core/script/renderer.js b/js/helper-classes/RDGE/src/core/script/renderer.js
index 517947df..04cb36a7 100644
--- a/js/helper-classes/RDGE/src/core/script/renderer.js
+++ b/js/helper-classes/RDGE/src/core/script/renderer.js
@@ -359,9 +359,11 @@ _renderer = function(canvas) {
359 * @param wrap - optional "CLAMP or "REPEAT", default is clamp 359 * @param wrap - optional "CLAMP or "REPEAT", default is clamp
360 * @param mips - optional true/false value to create mipmaps, the default is true 360 * @param mips - optional true/false value to create mipmaps, the default is true
361 */ 361 */
362 this.unloadedTextureCount = 0;
362 _texparams = function(wrap, mips) { this.wrap = wrap, this.mips = mips }; 363 _texparams = function(wrap, mips) { this.wrap = wrap, this.mips = mips };
363 this.createTexture = function(url, wrap, mips) { 364 this.createTexture = function(url, wrap, mips) {
364 var texture = this.ctx.createTexture(); 365 var texture = this.ctx.createTexture();
366 this.unloadedTextureCount++;
365 367
366 if (wrap === undefined) 368 if (wrap === undefined)
367 wrap = "CLAMP"; 369 wrap = "CLAMP";
@@ -379,7 +381,18 @@ _renderer = function(canvas) {
379 stateMan.RDGEInitState.loadTexture(texture); 381 stateMan.RDGEInitState.loadTexture(texture);
380 //console.log( "loaded texture: " + texture.lookUpName ); 382 //console.log( "loaded texture: " + texture.lookUpName );
381 if (texture.callback) texture.callback( texture ); 383 if (texture.callback) texture.callback( texture );
384 this.context.renderer.unloadedTextureCount--;
385 if (this.context.renderer.unloadedTextureCount < 0)
386 console.log( "more textures loaded then created..." );
382 }; 387 };
388 texture.image.onerror = function() {
389 this.context.renderer.unloadedTextureCount--;
390 if (texture.callback) texture.callback( texture );
391 console.log( "Error loading texture: " + texture.image.src );
392 if (this.context.renderer.unloadedTextureCount < 0)
393 console.log( "more textures loaded then created..." );
394 }
395
383 } 396 }
384 return texture; 397 return texture;
385 } 398 }