mirror of https://github.com/axmolengine/axmol.git
Merge pull request #2818 from dumganhar/develop
[develop] Minor fix for CCSprite::draw(), checking whether texture is valid, if it's invalid, don't set the attribute for it.
This commit is contained in:
commit
d85da8725e
|
@ -554,18 +554,14 @@ void CCSprite::draw(void)
|
|||
if (m_pobTexture != NULL)
|
||||
{
|
||||
ccGLBindTexture2D( m_pobTexture->getName() );
|
||||
ccGLEnableVertexAttribs( kCCVertexAttribFlag_PosColorTex );
|
||||
}
|
||||
else
|
||||
{
|
||||
ccGLBindTexture2D(0);
|
||||
ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position | kCCVertexAttribFlag_Color );
|
||||
}
|
||||
|
||||
//
|
||||
// Attributes
|
||||
//
|
||||
|
||||
ccGLEnableVertexAttribs( kCCVertexAttribFlag_PosColorTex );
|
||||
|
||||
#define kQuadSize sizeof(m_sQuad.bl)
|
||||
#ifdef EMSCRIPTEN
|
||||
long offset = 0;
|
||||
|
@ -578,9 +574,12 @@ void CCSprite::draw(void)
|
|||
int diff = offsetof( ccV3F_C4B_T2F, vertices);
|
||||
glVertexAttribPointer(kCCVertexAttrib_Position, 3, GL_FLOAT, GL_FALSE, kQuadSize, (void*) (offset + diff));
|
||||
|
||||
if (m_pobTexture != NULL)
|
||||
{
|
||||
// texCoods
|
||||
diff = offsetof( ccV3F_C4B_T2F, texCoords);
|
||||
glVertexAttribPointer(kCCVertexAttrib_TexCoords, 2, GL_FLOAT, GL_FALSE, kQuadSize, (void*)(offset + diff));
|
||||
}
|
||||
|
||||
// color
|
||||
diff = offsetof( ccV3F_C4B_T2F, colors);
|
||||
|
|
Loading…
Reference in New Issue