Merge pull request #837 from dumganhar/gles20

fixed #1158: Fixed a bug in CCParticleSystemQuad.
We need to check whether need to free quads and delete vbo/vao in the destructor.

CCParticleSystemQuad::~CCParticleSystemQuad()
{
if (NULL == m_pBatchNode) // important
{
CC_SAFE_FREE(m_pQuads);
CC_SAFE_FREE(m_pIndices);
glDeleteBuffers(2, &m_pBuffersVBO[0]);
glDeleteVertexArrays(1, &m_uVAOname);
}
}
This commit is contained in:
James Chen 2012-04-12 20:43:02 -07:00
commit be525c7e57
1 changed files with 7 additions and 4 deletions

View File

@ -76,10 +76,13 @@ CCParticleSystemQuad::CCParticleSystemQuad()
CCParticleSystemQuad::~CCParticleSystemQuad()
{
CC_SAFE_FREE(m_pQuads);
CC_SAFE_FREE(m_pIndices);
glDeleteBuffers(2, &m_pBuffersVBO[0]);
glDeleteVertexArrays(1, &m_uVAOname);
if (NULL == m_pBatchNode)
{
CC_SAFE_FREE(m_pQuads);
CC_SAFE_FREE(m_pIndices);
glDeleteBuffers(2, &m_pBuffersVBO[0]);
glDeleteVertexArrays(1, &m_uVAOname);
}
}
// implementation CCParticleSystemQuad