mirror of https://github.com/axmolengine/axmol.git
Fixing a bug that display is wrong when setting setTexture(NULL) for CCSprite.
This commit is contained in:
parent
5c592943db
commit
1a5e9f3717
|
@ -153,8 +153,6 @@ bool CCSprite::initWithTexture(CCTexture2D *pTexture, const CCRect& rect, bool r
|
|||
if (CCNodeRGBA::init())
|
||||
{
|
||||
m_pobBatchNode = NULL;
|
||||
// shader program
|
||||
setShaderProgram(CCShaderCache::sharedShaderCache()->programForKey(kCCShader_PositionTextureColor));
|
||||
|
||||
m_bRecursiveDirty = false;
|
||||
setDirty(false);
|
||||
|
@ -1085,6 +1083,16 @@ void CCSprite::setTexture(CCTexture2D *texture)
|
|||
// accept texture==nil as argument
|
||||
CCAssert( !texture || dynamic_cast<CCTexture2D*>(texture), "setTexture expects a CCTexture2D. Invalid argument");
|
||||
|
||||
// shader program
|
||||
if (texture)
|
||||
{
|
||||
setShaderProgram(CCShaderCache::sharedShaderCache()->programForKey(kCCShader_PositionTextureColor));
|
||||
}
|
||||
else
|
||||
{
|
||||
setShaderProgram(CCShaderCache::sharedShaderCache()->programForKey(kCCShader_PositionColor));
|
||||
}
|
||||
|
||||
if (!m_pobBatchNode && m_pobTexture != texture)
|
||||
{
|
||||
CC_SAFE_RETAIN(texture);
|
||||
|
|
Loading…
Reference in New Issue