更换图片资源报错:WebGL: INVALID_VALUE: texSubImage2D: no image

  • Creator 版本:2.3.1

  • 目标平台: 微信小游戏

场景放一个Sprite, Sprite Frame拖了一张png图片过去(不是图集,单独一张png),png大小是720*368,png名字为bg.png

我把bg.png用一张新的图片代替,名字相同,大小变成360368,其他什么都没改。发布微信小游戏后,这个图片拿不到了(大小改成720368之后,又正常了,一改回360*368就不行)。
有哪位大佬知道是怎么回事吗?

提示:

详细信息如下:
i.(anonymous function) @ VM264 WAGame.js:2
266.i._setSubImage @ cocos2d-js-min.js:1
266.i.updateSubImage @ cocos2d-js-min.js:1
drawTextureAt @ cocos2d-js-min.js:1
insertSpriteFrame @ cocos2d-js-min.js:1
insertSpriteFrame @ cocos2d-js-min.js:1
168.i.packToDynamicAtlas @ cocos2d-js-min.js:1
194.i.updateRenderData @ cocos2d-js-min.js:1
174.A._updateRenderData @ cocos2d-js-min.js:1
174.A._worldTransform @ cocos2d-js-min.js:1
174.A._localTransform @ cocos2d-js-min.js:1
174.A._children @ cocos2d-js-min.js:1
174.A._color @ cocos2d-js-min.js:1
174.A._opacity @ cocos2d-js-min.js:1
174.A._worldTransform @ cocos2d-js-min.js:1
174.A._localTransform @ cocos2d-js-min.js:1
174.A._children @ cocos2d-js-min.js:1
174.A._children @ cocos2d-js-min.js:1
174.x.visitRootNode @ cocos2d-js-min.js:1
174.x.render @ cocos2d-js-min.js:1
render @ cocos2d-js-min.js:1
mainLoop @ cocos2d-js-min.js:1
e @ adapter-min.js? [sm]:1
requestAnimationFrame (async)
wxRequestAnimationFrame @ gamePage.html:38
e @ adapter-min.js? [sm]:1
requestAnimationFrame (async)
wxRequestAnimationFrame @ gamePage.html:38
e @ adapter-min.js? [sm]:1
requestAnimationFrame (async)
wxRequestAnimationFrame @ gamePage.html:38
e @ adapter-min.js? [sm]:1
requestAnimationFrame (async)
wxRequestAnimationFrame @ gamePage.html:38
e @ adapter-min.js? [sm]:1
requestAnimationFrame (async)
wxRequestAnimationFrame @ gamePage.html:38
e @ adapter-min.js? [sm]:1
requestAnimationFrame (async)
wxRequestAnimationFrame @ gamePage.html:38
e @ adapter-min.js? [sm]:1
requestAnimationFrame (async)
wxRequestAnimationFrame @ gamePage.html:38
e @ adapter-min.js? [sm]:1
requestAnimationFrame (async)
wxRequestAnimationFrame @ gamePage.html:38
e @ adapter-min.js? [sm]:1
requestAnimationFrame (async)
wxRequestAnimationFrame @ gamePage.html:38
e @ adapter-min.js? [sm]:1
requestAnimationFrame (async)
wxRequestAnimationFrame @ gamePage.html:38
e @ adapter-min.js? [sm]:1
requestAnimationFrame (async)
wxRequestAnimationFrame @ gamePage.html:38
e @ adapter-min.js? [sm]:1
requestAnimationFrame (async)
wxRequestAnimationFrame @ gamePage.html:38
e @ adapter-min.js? [sm]:1
requestAnimationFrame (async)
wxRequestAnimationFrame @ gamePage.html:38
e @ adapter-min.js? [sm]:1
requestAnimationFrame (async)
wxRequestAnimationFrame @ gamePage.html:38
e @ adapter-min.js? [sm]:1
requestAnimationFrame (async)
wxRequestAnimationFrame @ gamePage.html:38
e @ adapter-min.js? [sm]:1
requestAnimationFrame (async)
wxRequestAnimationFrame @ gamePage.html:38
e @ adapter-min.js? [sm]:1
requestAnimationFrame (async)
wxRequestAnimationFrame @ gamePage.html:38
e @ adapter-min.js? [sm]:1
requestAnimationFrame (async)
wxRequestAnimationFrame @ gamePage.html:38
e @ adapter-min.js? [sm]:1
requestAnimationFrame (async)
wxRequestAnimationFrame @ gamePage.html:38
e @ adapter-min.js? [sm]:1
requestAnimationFrame (async)
wxRequestAnimationFrame @ gamePage.html:38
e @ adapter-min.js? [sm]:1
requestAnimationFrame (async)
wxRequestAnimationFrame @ gamePage.html:38
e @ adapter-min.js? [sm]:1
requestAnimationFrame (async)
wxRequestAnimationFrame @ gamePage.html:38
e @ adapter-min.js? [sm]:1
requestAnimationFrame (async)
wxRequestAnimationFrame @ gamePage.html:38
e @ adapter-min.js? [sm]:1
requestAnimationFrame (async)
wxRequestAnimationFrame @ gamePage.html:38
e @ adapter-min.js? [sm]:1
requestAnimationFrame (async)
wxRequestAnimationFrame @ gamePage.html:38
e @ adapter-min.js? [sm]:1
requestAnimationFrame (async)
wxRequestAnimationFrame @ gamePage.html:38
e @ adapter-min.js? [sm]:1
requestAnimationFrame (async)
wxRequestAnimationFrame @ gamePage.html:38
e @ adapter-min.js? [sm]:1
requestAnimationFrame (async)
wxRequestAnimationFrame @ gamePage.html:38
e @ adapter-min.js? [sm]:1
requestAnimationFrame (async)
wxRequestAnimationFrame @ gamePage.html:38
e @ adapter-min.js? [sm]:1
requestAnimationFrame (async)
wxRequestAnimationFrame @ gamePage.html:38
e @ adapter-min.js? [sm]:1
requestAnimationFrame (async)
wxRequestAnimationFrame @ gamePage.html:38
e @ adapter-min.js? [sm]:1
requestAnimationFrame (async)
wxRequestAnimationFrame @ gamePage.html:38
e @ adapter-min.js? [sm]:1

找到原因了,把下面2句代码注释掉就可以了。
cc.macro.CLEANUP_IMAGE_CACHE = false;
cc.dynamicAtlasManager.enabled = true;
难道是微信小游戏不支持动态图集?

你好,微信小游戏默认不开启动态图集。在新版本引擎中,已经修复了这个问题。

文档上说是因为内存太大默认关闭,但是没有说不支持吧,请问具体是什么原因呢?这么强大的功能,不支持的话就太郁闷了,好好的图片画不出来

找到规律了,在微信小游戏平台,凡是直接被场景引用的图片(没有预置体引用),未加入自动图集的(不大于512),就会显示不出来,解决方法就是所在目录加上AutoAltas,要用就都用
目前测试正常,不知道猜的对不对 @337031709 @zilong

能说说你的 CocosCreator 版本么?重现方法是什么?我们已经修复过微信小游戏上动态图集的问题。你可以用新版本的 CocosCreator 试试。

试过2.2.2,2.3.3等版本,表现都一样,在微信小程序真机上开启动态合图,未加入AutoAltas的小图绘制不出来

3.1.0 在微信开发工具上报错 Failed to execute ‘texSubImage2D’ on ‘WebGLRenderingContext’: No function was found that matched the signature provided 这是什么原因导致的

你好,这个调用堆栈是引擎使用动态图集时的调用,建议你这边关闭引擎的动态图集试试。
在编辑器的顶部菜单栏,打开项目设置,勾选 CLEANUP_IMAGE_CACHE,关闭动态图集:

谢谢 大佬这个处理是可以的

3.1.0 使用2Dlabel转贴图到模型上显示不出来2 这是预制,然后3.1.0渲染的效果3 出现不出label文字,但是3.以下的引擎可以渲染出来4 想问下3.1.0得怎么调整修改

大佬。我在cocos3d 1.2.0版本出现同样的问题,但是按照这种办法,没有解决 :neutral_face:

该主题在最后一个回复创建后14天后自动关闭。不再允许新的回复。