cocos2d / cocos2d-x

Cocos2d-x is a suite of open-source, cross-platform, game-development tools utilized by millions of developers across the globe. Its core has evolved to serve as the foundation for Cocos Creator 1.x & 2.x.
https://www.cocos.com/en/cocos2d-x
18.02k stars 7.05k forks source link

fix the bug that ect1 texture lost on android #20762

Open Canon0223 opened 1 year ago

Canon0223 commented 1 year ago

Steps to Reproduce:

17278 not fix the bug

// etc1 support check whether alpha texture exists & load it auto alphaFile = vt->_fileName + TextureCache::getETC1AlphaFileSuffix(); Texture2D::PixelFormat oldPixelFormat = Texture2D::getDefaultAlphaPixelFormat();
reloadTexture(vt->_texture->getAlphaTexture(), alphaFile, vt->_pixelFormat);

//After reload alphaTexture, you should setAlphaTexture,Like: vt->_texture->setAlphaTexture(vt->_texture->getAlphaTexture());

//otherwise,ect1 texture will lost still