From 0f1ab7ab37378844652ae96621e6683c157ffa48 Mon Sep 17 00:00:00 2001 From: James Chen Date: Tue, 27 Mar 2012 10:55:13 +0800 Subject: [PATCH] issue #1056: Updated SpriteTest, reverted the last parameter of glDrawElement in CCTextureAtlas.cpp and CCParticleSystemQuad.cpp. --- cocos2dx/particle_nodes/CCParticleSystemQuad.cpp | 5 +---- cocos2dx/textures/CCTextureAtlas.cpp | 7 ++----- tests/tests/SpriteTest/SpriteTest.cpp.REMOVED.git-id | 2 +- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/cocos2dx/particle_nodes/CCParticleSystemQuad.cpp b/cocos2dx/particle_nodes/CCParticleSystemQuad.cpp index 3e9ca3a23d..1940022eb9 100644 --- a/cocos2dx/particle_nodes/CCParticleSystemQuad.cpp +++ b/cocos2dx/particle_nodes/CCParticleSystemQuad.cpp @@ -301,10 +301,7 @@ void CCParticleSystemQuad::draw() glBindVertexArray( m_uVAOname ); - /* FIXME: It will cause crash on some devices if the last parameter is zero. - I'm not familiar with opengles, but my change works. --By James Chen. - */ - glDrawElements(GL_TRIANGLES, (GLsizei) m_uParticleIdx*6, GL_UNSIGNED_SHORT, m_pIndices /*0*/); + glDrawElements(GL_TRIANGLES, (GLsizei) m_uParticleIdx*6, GL_UNSIGNED_SHORT, 0); glBindVertexArray( 0 ); diff --git a/cocos2dx/textures/CCTextureAtlas.cpp b/cocos2dx/textures/CCTextureAtlas.cpp index 5ed1bd3a12..8ae0041460 100644 --- a/cocos2dx/textures/CCTextureAtlas.cpp +++ b/cocos2dx/textures/CCTextureAtlas.cpp @@ -564,13 +564,10 @@ void CCTextureAtlas::drawNumberOfQuads(unsigned int n, unsigned int start) glBindVertexArray( m_uVAOname ); -/* FIXME: Because start always is zero, the result of (start*6*sizeof(m_pIndices[0])) will always be zero too. And crash will appear on some devices. - I'm not familiar with opengles, but my change works. --By James Chen. -*/ #if CC_TEXTURE_ATLAS_USE_TRIANGLE_STRIP - glDrawElements(GL_TRIANGLE_STRIP, (GLsizei) n*6, GL_UNSIGNED_SHORT, (GLvoid*) (m_pIndices)/*(start*6*sizeof(m_pIndices[0]))*/ ); + glDrawElements(GL_TRIANGLE_STRIP, (GLsizei) n*6, GL_UNSIGNED_SHORT, (GLvoid*) (start*6*sizeof(m_pIndices[0])) ); #else - glDrawElements(GL_TRIANGLES, (GLsizei) n*6, GL_UNSIGNED_SHORT, (GLvoid*) (m_pIndices)/*(start*6*sizeof(m_pIndices[0]))*/ ); + glDrawElements(GL_TRIANGLES, (GLsizei) n*6, GL_UNSIGNED_SHORT, (GLvoid*) (start*6*sizeof(m_pIndices[0])) ); #endif // CC_TEXTURE_ATLAS_USE_TRIANGLE_STRIP diff --git a/tests/tests/SpriteTest/SpriteTest.cpp.REMOVED.git-id b/tests/tests/SpriteTest/SpriteTest.cpp.REMOVED.git-id index 304172efe9..010b92d729 100644 --- a/tests/tests/SpriteTest/SpriteTest.cpp.REMOVED.git-id +++ b/tests/tests/SpriteTest/SpriteTest.cpp.REMOVED.git-id @@ -1 +1 @@ -45fa60a7892453b6d2be3554738d829d7743303e \ No newline at end of file +d70da79e607d706c0f2053915e70a713e2f61f85 \ No newline at end of file