tips4design Posted August 10, 2016 Share Posted August 10, 2016 I was looking over the WebGL draw calls done by my Phaser game and at the end of each loop I see the calls in attachment. Both are some transparent png textures. Why are those called? Can't those be removed if they are unused? LE: My guess is that the blank Texture 27 can actually be an empty DisplayObject, I tried looking over my code, but setting renderable to false to the empty groups or sprites I had didn't remove that texture draw call. Link to comment Share on other sites More sharing options...
stupot Posted August 11, 2016 Share Posted August 11, 2016 Looks like it's the default image. Look in the Phaser source code in file src\loader\cache.js for function addDefaultImage /** * Adds a default image to be used in special cases such as WebGL Filters. * It uses the special reserved key of `__default`. * This method is called automatically when the Cache is created. * This image is skipped when `Cache.destroy` is called due to its internal requirements. * * @method Phaser.Cache#addDefaultImage * @protected */ addDefaultImage: function () { var img = new Image(); img.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgAQMAAABJtOi3AAAAA1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAABVJREFUeF7NwIEAAAAAgKD9qdeocAMAoAABm3DkcAAAAABJRU5ErkJggg=="; var obj = this.addImage('__default', null, img); // Because we don't want to invalidate the sprite batch for an invisible texture obj.base.skipRender = true; // Make it easily available within the rest of Phaser / Pixi Phaser.Cache.DEFAULT = new PIXI.Texture(obj.base); }, Link to comment Share on other sites More sharing options...
Recommended Posts