这个不是经常用到,但偶尔又需要,记录一下。
缩小抗锯齿:(要求是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