cocos2dx 抗锯齿

这个不是经常用到,但偶尔又需要,记录一下。

 

缩小抗锯齿:(要求是pot图片,即2的n次方的宽高的图片)

CCTexture2D* pTexture =  sprite:getTexture();

pTexture->generateMipmap();

ccTexParams texParams = {GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE};

pTexture->setTexParameters(&texParams);

  

放大抗锯齿:

CCSprite *firedragon=CCSprite::create("firedragonpzy.png");  
//抗锯齿方法
firedragon->getTexture()->setAntiAliasTexParameters();  

  

lua 下ccTexparams 的生成:

    local tp = ccTexParams()
    tp.minFilter = GL_LINEAR_MIPMAP_LINEAR
    tp.magFilter = GL_LINEAR
    tp.wrapS = GL_CLAMP_TO_EDGE
    tp.wrapT = GL_CLAMP_TO_EDGE

  

posted @ 2016-07-29 16:30  JohnKing_  阅读(1798)  评论(0编辑  收藏  举报