Growler

Texture cache overflow: 16 texture units available.

Recommended Posts

Using MelonJS 5.1 (I cannot upgrade at this point), I'm creating a fairly large adventure game. My TMX map loaded fine until I added water tile layer:

https://i.imgur.com/i5kpTuc.png

https://i.imgur.com/BzsxXTn.png

At which point I started getting error: Texture cache overflow: 16 texture units available.

Error name is me.video.Error

Digging into the code, I see there is a max size for the Texture Cache:

        validate : function () {
            if (this.length >= this.max_size) {
                // TODO: Merge textures instead of throwing an exception
                throw new me.video.Error(
                    "Texture cache overflow: " + this.max_size +
                    " texture units available."
                );
            }
        },

How can I fix this?

Btw this seems to have been fixed in 2015: https://github.com/melonjs/melonJS/issues/595

@obiot @Parasyte

Share this post


Link to post
Share on other sites

the issue is that WebGL has a limited amount of texture, and as of today the limit is 16 for ~70% of devices :

https://webglstats.com/webgl/parameter/MAX_TEXTURE_IMAGE_UNITS

in my opinion the only way to fix that is either to pack/merge your tilesets directly, or to use TexturePacker (that was the fix back in 2015) when possible (https://github.com/melonjs/melonJS/wiki/How-to-use-Texture-Atlas-with-TexturePacker)

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.