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)
|
if (m_pobTexture != NULL)
|
||||||
{
|
{
|
||||||
ccGLBindTexture2D( m_pobTexture->getName() );
|
ccGLBindTexture2D( m_pobTexture->getName() );
|
||||||
|
ccGLEnableVertexAttribs( kCCVertexAttribFlag_PosColorTex );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ccGLBindTexture2D(0);
|
ccGLBindTexture2D(0);
|
||||||
|
ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position | kCCVertexAttribFlag_Color );
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Attributes
|
|
||||||
//
|
|
||||||
|
|
||||||
ccGLEnableVertexAttribs( kCCVertexAttribFlag_PosColorTex );
|
|
||||||
|
|
||||||
#define kQuadSize sizeof(m_sQuad.bl)
|
#define kQuadSize sizeof(m_sQuad.bl)
|
||||||
#ifdef EMSCRIPTEN
|
#ifdef EMSCRIPTEN
|
||||||
long offset = 0;
|
long offset = 0;
|
||||||
|
@ -578,9 +574,12 @@ void CCSprite::draw(void)
|
||||||
int diff = offsetof( ccV3F_C4B_T2F, vertices);
|
int diff = offsetof( ccV3F_C4B_T2F, vertices);
|
||||||
glVertexAttribPointer(kCCVertexAttrib_Position, 3, GL_FLOAT, GL_FALSE, kQuadSize, (void*) (offset + diff));
|
glVertexAttribPointer(kCCVertexAttrib_Position, 3, GL_FLOAT, GL_FALSE, kQuadSize, (void*) (offset + diff));
|
||||||
|
|
||||||
|
if (m_pobTexture != NULL)
|
||||||
|
{
|
||||||
// texCoods
|
// texCoods
|
||||||
diff = offsetof( ccV3F_C4B_T2F, texCoords);
|
diff = offsetof( ccV3F_C4B_T2F, texCoords);
|
||||||
glVertexAttribPointer(kCCVertexAttrib_TexCoords, 2, GL_FLOAT, GL_FALSE, kQuadSize, (void*)(offset + diff));
|
glVertexAttribPointer(kCCVertexAttrib_TexCoords, 2, GL_FLOAT, GL_FALSE, kQuadSize, (void*)(offset + diff));
|
||||||
|
}
|
||||||
|
|
||||||
// color
|
// color
|
||||||
diff = offsetof( ccV3F_C4B_T2F, colors);
|
diff = offsetof( ccV3F_C4B_T2F, colors);
|
||||||
|
|
Loading…
Reference in New Issue