CCTextureCache::addPVRImage() add pvr texture as CCImage::kFmtRawData
but VolatileTexture::reloadTexture()using CCImage::initWithImageData() which don’t support pvr format.
I have change the code like this:
switch (vt->m_eCashedImageType)
{
case kImageFile:
{
std::string lowerCase(vt->m_strFileName);
for (unsigned int i = 0; i < lowerCase.length(); ++i)
{
lowerCase[i] = tolower(lowerCase[i]);
}
if (std::string::npos != lowerCase.find(".pvr"))
{
vt->texture->initWithPVRFile(vt->m_strFileName.c_str());
} else
{
CCImage image;
CCFileData data(vt->m_strFileName.c_str(), "rb");
unsigned long nSize = data.getSize();
unsigned char* pBuffer = data.getBuffer();
if (image.initWithImageData((void*)pBuffer, nSize, vt->m_FmtImage))
{
CCTexture2DPixelFormat oldPixelFormat = CCTexture2D::defaultAlphaPixelFormat();
CCTexture2D::setDefaultAlphaPixelFormat(vt->m_PixelFormat);
vt->texture->initWithImage(ℑ);
CCTexture2D::setDefaultAlphaPixelFormat(oldPixelFormat);
}
}
}
break;
case kImageData:
.
.
.
CCTextureCache::addPVRImage() add pvr texture as CCImage::kFmtRawData
but VolatileTexture::reloadTexture()using CCImage::initWithImageData() which don’t support pvr format.
I have change the code like this: