我的图像看起来有太多的黑色。我使用函数setBlendFunc。
但是,当精灵没有运行动画时,它将工作。如果运行,它将不起作用。如何解决这个问题?
CCSprite *effectSprite=CCSprite::create("init_black.png");
effectSprite->setBlendFunc((ccBlendFunc) {GL_ONE, GL_ONE});
SoliderSprite *enemySolider=(SoliderSprite *)(enemy->objectAtIndex(0));
CCArray *position=enemySolider->soliderPosition;
position->retain();
cout<<((CCString *)position->objectAtIndex(0))->intValue()<<endl;
effectSprite->setPosition(ccp(((CCString *)position->objectAtIndex(0))->intValue(),((CCString *)position->objectAtIndex(1))->intValue()));
this->addChild(effectSprite);
string effectString="effect";
if(this->direction)
{
msg.property[1].append("L");
}
else
{
msg.property[1].append("R");
}
CCAnimate *effectAction=animate->createWithKind(msg.property[1],effectString.c_str(),2);
effectSprite->runAction(effectAction);
position->release();发布于 2013-09-03 17:12:05
这似乎是一个bug,新版本没有这个问题。在cocos2d-x的2.1.5版本中尝试以下代码:
CCSprite someSprite = CCSprite.spriteWithFile("someImage");
ccBlendFunc someBlend = new ccBlendFunc();
someBlend.src = OGLES.GL_ONE;
someBlend.dst = OGLES.GL_ONE;
someSprite.BlendFunc = someBlend;发布于 2014-03-13 13:30:09
我认为渲染模式并不是你想要展示的最终效果。如何使用:
SRC = GL_SRC_ALPHA,
SRC = GL_ONE_MINUS_SRC_ALPHAhttps://stackoverflow.com/questions/11444598
复制相似问题