我们在做游戏优化的时候,内存占用过大,降低内存的最有效方法就是纹理压缩。
在iOS设备中支持的是PVR压缩,在Android中支持的是ETC压缩。
这次主要来说pvr压缩,对图片要求:尺寸为2的N次幂,并且宽高相同。
压缩工具:Mac下的texturetool(所在路径:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/texturetool)
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/texturetool -f PVR -e PVRTC --bits-per-pixel-4 -o [pvr去的新路径] [原来的路径]
例如:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/texturetool -f PVR -e PVRTC --bits-per-pixel-4 -o test.png test.png