当我尝试在设备上加载 PVR 图像时出现此错误。它在 iPhone 5s、5、4s 和 iPad 上运行良好,但在 4 上就不行了。我的 PVR 图像大小是:width = 4096
和height = 2048
.
Cocos2d: cocos2d: TexturePVR: Error uploading compressed texture level: 0 . glError: 0x0501
Cocos2d: cocos2d: Couldn't load PVR image /var/mobile/Applications/7CF6C347-8B63-4C1E-857A-41F48C8ACBEF/Race.app/Images/BackGround/bg1.pvr.ccz
Cocos2d: cocos2d: Couldn't add PVRImage:Images/BackGround/bg1.pvr.ccz in CCTextureCache
我得到这个表格这个链接:
支持的尺寸为:iPhone 3gs / iPhone 4 / iPad 1 / iPod 3 / 4 : 2048x2048 iPad 2 / 3 / 4 / Mini / iPhone 4S / 5 / iPod 5 : 4096x4096
顺便说一句,您可以导入 4096x4096 的纹理并打开 mip 贴图,这将在旧设备上自动使用较小分辨率的纹理。
但是如何打开 mip-maps .. 这有什么作用?
// support mipmap filtering
sprite->getTexture()->generateMipmap();
ccTexParams texParams = { GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE };
sprite->getTexture()->setTexParameters(&texParams);