diff --git a/cocos/2d/renderer/Renderer.cpp b/cocos/2d/renderer/Renderer.cpp index 5820046d3f..ab0a0bf323 100644 --- a/cocos/2d/renderer/Renderer.cpp +++ b/cocos/2d/renderer/Renderer.cpp @@ -236,11 +236,9 @@ void Renderer::render() if(command->getType() == QUAD_COMMAND) { QuadCommand* cmd = static_cast(command); - - CCASSERT(cmd->getQuadCount()getQuadCount() < VBO_SIZE) + if(_numQuads + cmd->getQuadCount() <= VBO_SIZE) { memcpy(_quads + _numQuads, cmd->getQuad(), sizeof(V3F_C4B_T2F_Quad) * cmd->getQuadCount()); _numQuads += cmd->getQuadCount(); @@ -248,8 +246,11 @@ void Renderer::render() } else { + CCASSERT(cmd->getQuadCount() < VBO_SIZE, "VBO is not big enough for quad data, please break the quad data down or use customized render command"); + //Draw batched quads if VBO is full drawBatchedQuads(); + i--; } } else if(command->getType() == CUSTOM_COMMAND)