Projects > cpp > Issues > Bug #4338

We are migrating issue tracker of Cocos2d-x Project to Github, please create new issue there. Thanks.

Create Issue on Github

PVRTC4 image format problems with mipmapping

Bug #4338 [Closed]
sp_sergio 2014-03-10 12:42 . Updated about 2 years ago

I'm using latest version 2 of cocos-2d-x and I have problems using mipmaps and pvrtc files. I used test app to change the example of scaling pvrtc, to play my files... in this case I work with a pvr.ccz file that uses RGBA8888 format (without incrusted mipmaps) and activating mipmaps it works well. When I work with a pvr.ccz file that uses PVRTC4 format (without incrusted mipmaps) It generates wrong mipmaps (showing a lot of color artifacts and transparency) and it works really bad.

this is the modified code I use:

    TextureDemo::onEnter();
    auto s = Director::getInstance()->getWinSize();

    auto imgMipMap = Sprite::create("Images/tree.pvr.ccz");
    if( imgMipMap )
    {
        imgMipMap->setPosition(Point( s.width/2.0f-100, s.height/2.0f));
        addChild(imgMipMap);

        // support mipmap filtering
        imgMipMap->getTexture()->generateMipmap();
        Texture2D::TexParams texParams = { GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE };
        imgMipMap->getTexture()->setTexParameters(texParams);
    }

    auto img = Sprite::create("Images/tree2.pvr.ccz");
    if( img )
    {
        img->setPosition(Point( s.width/2.0f+100, s.height/2.0f));
        addChild(img);

        auto scale1 = EaseOut::create(ScaleBy::create(4, 0.01f), 3);
        auto sc_back = scale1->reverse();

        auto scale2 = scale1->clone();
        auto sc_back2 = scale2->reverse();

        imgMipMap->runAction(RepeatForever::create(Sequence::create(scale1, sc_back, NULL)));
        img->runAction(RepeatForever::create(Sequence::create(scale2, sc_back2, NULL)));
    }
    log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());

I tested this right now with a file generated with texturepacker and it doesn't work for me. the image has premultiply alpha disabled and it has no mipmaps generated (I uploaded the image for testing).

I have tested this in an Iphone4 with ios 6.1.3 because in ios 7 the "glGenerateMipmap(GL_TEXTURE_2D);" returns a 1282 error (invalid operation).

last_tree.pvr.ccz (11.7 kB) sp_sergio, 2014-03-10 12:42

walzer@cocos2d-x.org 2014-10-08 02:49

Redmine issue system is closed, we are using github issue system instead.

This issue was moved to https://github.com/cocos2d/cocos2d-x/issues/8357

Atom PDF

Status:Closed
Start date:2014-03-10
Priority:Low
Due date:
Assignee:-
% Done:

0%

Category:ios, mac
Target version:-

Sign up for our newsletter to keep up with the latest developments, releases and updates for Cocos2d-x.