Peteo chen pvr.ccz sometimes shows a white image.
Posts 5
Added by Peteo chen over 1 year ago

pvr.ccz sometimes shows a white image when I change scene.

I use below to generate pvr.ccz

${TP} --smart-update \
--format cocos2d \
--data Resources/flop/flop_card-hd.plist \
--sheet Resources/flop/flop_card-hd.pvr.ccz \
--dither-fs-alpha \
--premultiply-alpha \
--opt RGBA4444 \
Art/flop/*.png

Jeffery Rechardson RE: pvr.ccz sometimes shows a white image.
Posts 5
Added by Jeffery Rechardson over 1 year ago

I have same issue. Anybody have kind of solution?

Michael Ding RE: pvr.ccz sometimes shows a white image.
Posts 20
Added by Michael Ding 12 months ago

same to me when changing scenes, happens to me when Particle System is added to one scene. if removed particle system, everything is fine.. don't know why.

小 苏 RE: pvr.ccz sometimes shows a white image.
Posts 83
Added by 小 苏 12 months ago

I have same issue. and solve it by modify cocos2d-x source code of CCTexturePVR.cpp ,and test it's OK.
Plz take a look at that comment below!

bool CCTexturePVR::createGLTexture() {
unsigned int width = m_uWidth;
unsigned int height = m_uHeight;
GLenum err;

/////////////add by vincent begin 120602//////////////////
err = glGetError();
if (err != GL_NO_ERROR) {
printf("cocos2d: TexturePVR: glError: 0x%04X", err);
}
/////////////add by vincent end 120602//////////////////

if (m_uNumberOfMipmaps > 0)
{
if (m_uName != 0) {
glDeleteTextures(1, &m_uName);
}
glGenTextures(1, &m_uName);
glBindTexture(GL_TEXTURE_2D, m_uName);
}
// Generate textures with mipmaps
for (unsigned int i = 0; i < m_uNumberOfMipmaps; ++i) {
GLenum internalFormat = tableFormats[m_uTableFormatIndex][kCCInternalOpenGLInternalFormat];
GLenum format = tableFormats[m_uTableFormatIndex][kCCInternalOpenGLFormat];
GLenum type = tableFormats[m_uTableFormatIndex][kCCInternalOpenGLType];
bool compressed = tableFormats[m_uTableFormatIndex][kCCInternalCompressedImage] 1;
if (compressed  true && CCConfiguration::sharedConfiguration()->isSupportsPVRTC() == false) 
{
CCLOG("cocos2d: WARNING: PVRTC images are not supported");
return false;
}
unsigned char *data = m_asMipmaps[i].address;
unsigned int datalen = m_asMipmaps[i].len;
if (compressed == true)
{
glCompressedTexImage2D(GL_TEXTURE_2D, i, internalFormat, width, height, 0, datalen, data);
}
else {
glTexImage2D(GL_TEXTURE_2D, i, internalFormat, width, height, 0, format, type, data);
}
if(i > 0 && (width != height || ccNextPOT(width) != width ) )
{
CCLOG("cocos2d: TexturePVR. WARNING. Mipmap level %lu is not squared. Texture won't render correctly. width=%lu != height=%lu", i, width, height);
}
err = glGetError();
if (err != GL_NO_ERROR) {
CCLOG("cocos2d: TexturePVR: Error uploading compressed texture level: %u . glError: 0x%04X", (unsigned int)i, err);
return false;
}
//Update width and height to the next lower power of two
width = MAX(width >> 1, 1);
height = MAX(height >> 1, 1);
}
return true;
}

I had reported this bug to Minggo Zhang, maybe he can solve it in future.

Michael Ding RE: pvr.ccz sometimes shows a white image.
Posts 20
Added by Michael Ding 12 months ago

Wow it's great! it solve my problem!! Thanks a lot, 小 苏 (I am a copy-paster).

To all others, if you met the same problem, try his solution first.


(1-4/4)