diff --git a/cocos/2d/CCAtlasNode.cpp b/cocos/2d/CCAtlasNode.cpp index 741197e233..1cc4d752b2 100644 --- a/cocos/2d/CCAtlasNode.cpp +++ b/cocos/2d/CCAtlasNode.cpp @@ -151,7 +151,7 @@ void AtlasNode::draw(void) auto shader = ShaderCache::getInstance()->getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR_NO_MVP); - QuadCommand* cmd = QuadCommand::getCommandPool().generateCommand(); + QuadCommand* cmd = new QuadCommand(); cmd->init(0, _vertexZ, _textureAtlas->getTexture()->getName(), diff --git a/cocos/2d/CCClippingNode.cpp b/cocos/2d/CCClippingNode.cpp index 552b1f081c..ef47c97a8f 100644 --- a/cocos/2d/CCClippingNode.cpp +++ b/cocos/2d/CCClippingNode.cpp @@ -209,20 +209,20 @@ void ClippingNode::visit() Renderer* renderer = Director::getInstance()->getRenderer(); - GroupCommand* groupCommand = GroupCommand::getCommandPool().generateCommand(); + GroupCommand* groupCommand = new GroupCommand(); groupCommand->init(0,_vertexZ); renderer->addCommand(groupCommand); renderer->pushGroup(groupCommand->getRenderQueueID()); - CustomCommand* beforeVisitCmd = CustomCommand::getCommandPool().generateCommand(); + CustomCommand* beforeVisitCmd = new CustomCommand(); beforeVisitCmd->init(0,_vertexZ); beforeVisitCmd->func = CC_CALLBACK_0(ClippingNode::onBeforeVisit, this); renderer->addCommand(beforeVisitCmd); _stencil->visit(); - CustomCommand* afterDrawStencilCmd = CustomCommand::getCommandPool().generateCommand(); + CustomCommand* afterDrawStencilCmd = new CustomCommand(); afterDrawStencilCmd->init(0,_vertexZ); afterDrawStencilCmd->func = CC_CALLBACK_0(ClippingNode::onAfterDrawStencil, this); renderer->addCommand(afterDrawStencilCmd); @@ -253,7 +253,7 @@ void ClippingNode::visit() this->draw(); } - CustomCommand* afterVisitCmd = CustomCommand::getCommandPool().generateCommand(); + CustomCommand* afterVisitCmd = new CustomCommand(); afterVisitCmd->init(0,_vertexZ); afterVisitCmd->func = CC_CALLBACK_0(ClippingNode::onAfterVisit, this); renderer->addCommand(afterVisitCmd); diff --git a/cocos/2d/CCDrawNode.cpp b/cocos/2d/CCDrawNode.cpp index e0a15ef65f..9228db0441 100644 --- a/cocos/2d/CCDrawNode.cpp +++ b/cocos/2d/CCDrawNode.cpp @@ -241,7 +241,7 @@ void DrawNode::render() void DrawNode::draw() { - CustomCommand* cmd = CustomCommand::getCommandPool().generateCommand(); + CustomCommand* cmd = new CustomCommand(); cmd->init(0, _vertexZ); cmd->func = CC_CALLBACK_0(DrawNode::onDraw, this); Director::getInstance()->getRenderer()->addCommand(cmd); diff --git a/cocos/2d/CCLayer.cpp b/cocos/2d/CCLayer.cpp index 71c0b16dbc..55b17d5b28 100644 --- a/cocos/2d/CCLayer.cpp +++ b/cocos/2d/CCLayer.cpp @@ -564,7 +564,7 @@ void LayerColor::updateColor() void LayerColor::draw() { - CustomCommand* cmd = CustomCommand::getCommandPool().generateCommand(); + CustomCommand* cmd = new CustomCommand(); cmd->init(0, _vertexZ); cmd->func = CC_CALLBACK_0(LayerColor::onDraw, this); Director::getInstance()->getRenderer()->addCommand(cmd); diff --git a/cocos/2d/CCMotionStreak.cpp b/cocos/2d/CCMotionStreak.cpp index 70a00b622c..939245b238 100644 --- a/cocos/2d/CCMotionStreak.cpp +++ b/cocos/2d/CCMotionStreak.cpp @@ -358,7 +358,7 @@ void MotionStreak::draw() if(_nuPoints <= 1) return; kmGLGetMatrix(KM_GL_MODELVIEW,&_cachedMV); - CustomCommand* cmd = CustomCommand::getCommandPool().generateCommand(); + CustomCommand* cmd = new CustomCommand(); cmd->init(0,_vertexZ); cmd->func = CC_CALLBACK_0(MotionStreak::onDraw, this); Director::getInstance()->getRenderer()->addCommand(cmd); diff --git a/cocos/2d/CCNodeGrid.cpp b/cocos/2d/CCNodeGrid.cpp index 7053d184cf..47ca7272d0 100644 --- a/cocos/2d/CCNodeGrid.cpp +++ b/cocos/2d/CCNodeGrid.cpp @@ -92,7 +92,7 @@ void NodeGrid::visit() Renderer* renderer = Director::getInstance()->getRenderer(); - GroupCommand* groupCommand = GroupCommand::getCommandPool().generateCommand(); + GroupCommand* groupCommand = new GroupCommand(); groupCommand->init(0,_vertexZ); renderer->addCommand(groupCommand); renderer->pushGroup(groupCommand->getRenderQueueID()); @@ -105,7 +105,7 @@ void NodeGrid::visit() _nodeGrid->set2DProjection(); } - CustomCommand* gridBeginCmd = CustomCommand::getCommandPool().generateCommand(); + CustomCommand* gridBeginCmd = new CustomCommand(); gridBeginCmd->init(0,_vertexZ); gridBeginCmd->func = CC_CALLBACK_0(NodeGrid::onGridBeginDraw, this); renderer->addCommand(gridBeginCmd); @@ -154,7 +154,7 @@ void NodeGrid::visit() director->setProjection(beforeProjectionType); } - CustomCommand* gridEndCmd = CustomCommand::getCommandPool().generateCommand(); + CustomCommand* gridEndCmd = new CustomCommand(); gridEndCmd->init(0,_vertexZ); gridEndCmd->func = CC_CALLBACK_0(NodeGrid::onGridEndDraw, this); renderer->addCommand(gridEndCmd); diff --git a/cocos/2d/CCParticleBatchNode.cpp b/cocos/2d/CCParticleBatchNode.cpp index e046833d79..0156c33554 100644 --- a/cocos/2d/CCParticleBatchNode.cpp +++ b/cocos/2d/CCParticleBatchNode.cpp @@ -392,7 +392,7 @@ void ParticleBatchNode::draw(void) kmMat4 mv; kmGLGetMatrix(KM_GL_MODELVIEW, &mv); - QuadCommand* cmd = QuadCommand::getCommandPool().generateCommand(); + QuadCommand* cmd = new QuadCommand(); cmd->init(0, _vertexZ, _textureAtlas->getTexture()->getName(), diff --git a/cocos/2d/CCParticleSystemQuad.cpp b/cocos/2d/CCParticleSystemQuad.cpp index e63fe84baa..98c3f00c15 100644 --- a/cocos/2d/CCParticleSystemQuad.cpp +++ b/cocos/2d/CCParticleSystemQuad.cpp @@ -443,7 +443,7 @@ void ParticleSystemQuad::draw() auto shader = ShaderCache::getInstance()->getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR_NO_MVP); - QuadCommand* cmd = QuadCommand::getCommandPool().generateCommand(); + QuadCommand* cmd = new QuadCommand(); cmd->init(0, _vertexZ, _texture->getName(), shader, _blendFunc, _quads, _particleIdx, _modelViewTransform); Director::getInstance()->getRenderer()->addCommand(cmd); } diff --git a/cocos/2d/CCProgressTimer.cpp b/cocos/2d/CCProgressTimer.cpp index 35aaefc832..e9f85d9840 100644 --- a/cocos/2d/CCProgressTimer.cpp +++ b/cocos/2d/CCProgressTimer.cpp @@ -532,7 +532,7 @@ void ProgressTimer::draw() if( ! _vertexData || ! _sprite) return; - CustomCommand* cmd = CustomCommand::getCommandPool().generateCommand(); + CustomCommand* cmd = new CustomCommand(); cmd->init(0, _vertexZ); cmd->func = CC_CALLBACK_0(ProgressTimer::onDraw, this); Director::getInstance()->getRenderer()->addCommand(cmd); diff --git a/cocos/2d/CCRenderTexture.cpp b/cocos/2d/CCRenderTexture.cpp index 3ba91d0771..95a2944bad 100644 --- a/cocos/2d/CCRenderTexture.cpp +++ b/cocos/2d/CCRenderTexture.cpp @@ -329,7 +329,7 @@ void RenderTexture::beginWithClear(float r, float g, float b, float a, float dep this->begin(); //clear screen - CustomCommand* clearCmd = CustomCommand::getCommandPool().generateCommand(); + CustomCommand* clearCmd = new CustomCommand(); clearCmd->init(0, _vertexZ); clearCmd->func = CC_CALLBACK_0(RenderTexture::onClear, this); Director::getInstance()->getRenderer()->addCommand(clearCmd); @@ -348,7 +348,7 @@ void RenderTexture::clearDepth(float depthValue) this->begin(); - CustomCommand* cmd = CustomCommand::getCommandPool().generateCommand(); + CustomCommand* cmd = new CustomCommand(); cmd->init(0, _vertexZ); cmd->func = CC_CALLBACK_0(RenderTexture::onClearDepth, this); @@ -614,7 +614,7 @@ void RenderTexture::draw() begin(); //clear screen - CustomCommand* clearCmd = CustomCommand::getCommandPool().generateCommand(); + CustomCommand* clearCmd = new CustomCommand(); clearCmd->init(0, _vertexZ); clearCmd->func = CC_CALLBACK_0(RenderTexture::onClear, this); Director::getInstance()->getRenderer()->addCommand(clearCmd); @@ -643,14 +643,14 @@ void RenderTexture::begin() kmGLPushMatrix(); kmGLGetMatrix(KM_GL_MODELVIEW, &_transformMatrix); - GroupCommand* groupCommand = GroupCommand::getCommandPool().generateCommand(); + GroupCommand* groupCommand = new GroupCommand(); groupCommand->init(0, _vertexZ); Renderer *renderer = Director::getInstance()->getRenderer(); renderer->addCommand(groupCommand); renderer->pushGroup(groupCommand->getRenderQueueID()); - CustomCommand* beginCmd = CustomCommand::getCommandPool().generateCommand(); + CustomCommand* beginCmd = new CustomCommand(); beginCmd->init(0, _vertexZ); beginCmd->func = CC_CALLBACK_0(RenderTexture::onBegin, this); @@ -659,7 +659,7 @@ void RenderTexture::begin() void RenderTexture::end() { - CustomCommand* endCmd = CustomCommand::getCommandPool().generateCommand(); + CustomCommand* endCmd = new CustomCommand(); endCmd->init(0, _vertexZ); endCmd->func = CC_CALLBACK_0(RenderTexture::onEnd, this); diff --git a/cocos/2d/CCSpriteBatchNode.cpp b/cocos/2d/CCSpriteBatchNode.cpp index 024d438931..f553b3314c 100644 --- a/cocos/2d/CCSpriteBatchNode.cpp +++ b/cocos/2d/CCSpriteBatchNode.cpp @@ -360,7 +360,7 @@ void SpriteBatchNode::draw() kmMat4 mv; kmGLGetMatrix(KM_GL_MODELVIEW, &mv); - QuadCommand* cmd = QuadCommand::getCommandPool().generateCommand(); + QuadCommand* cmd = new QuadCommand(); cmd->init(0, _vertexZ, _textureAtlas->getTexture()->getName(), diff --git a/cocos/2d/renderer/CCCustomCommand.h b/cocos/2d/renderer/CCCustomCommand.h index 23986e5643..7e64a0a6dd 100644 --- a/cocos/2d/renderer/CCCustomCommand.h +++ b/cocos/2d/renderer/CCCustomCommand.h @@ -33,6 +33,10 @@ NS_CC_BEGIN class CustomCommand : public RenderCommand { +public: + CustomCommand(); + ~CustomCommand(); + public: static RenderCommandPool& getCommandPool() { return _commandPool; } @@ -52,9 +56,6 @@ public: std::function func; protected: - CustomCommand(); - ~CustomCommand(); - int _viewport; int32_t _depth; static RenderCommandPool _commandPool; @@ -62,6 +63,21 @@ protected: friend class RenderCommandPool; }; +template <> +class RenderCommandPool +{ +public: + CustomCommand* generateCommand() + { + return new CustomCommand(); + } + + void pushBackCommand(CustomCommand* ptr) + { + delete ptr; + } +}; + NS_CC_END #endif //_CC_CUSTOMCOMMAND_H_ diff --git a/cocos/2d/renderer/CCGroupCommand.h b/cocos/2d/renderer/CCGroupCommand.h index a265e00afe..d23a326141 100644 --- a/cocos/2d/renderer/CCGroupCommand.h +++ b/cocos/2d/renderer/CCGroupCommand.h @@ -52,6 +52,10 @@ protected: class GroupCommand : public RenderCommand { +public: + GroupCommand(); + ~GroupCommand(); + public: static RenderCommandPool& getCommandPool() { return _commandPool; } @@ -69,9 +73,6 @@ public: virtual void releaseToCommandPool() override; protected: - GroupCommand(); - ~GroupCommand(); - int _viewport; int32_t _depth; int _renderQueueID; @@ -80,6 +81,21 @@ protected: friend class RenderCommandPool; }; +template <> +class RenderCommandPool +{ +public: + GroupCommand* generateCommand() + { + return new GroupCommand(); + } + + void pushBackCommand(GroupCommand* ptr) + { + delete ptr; + } +}; + NS_CC_END #endif //_CC_GROUPCOMMAND_H_ diff --git a/cocos/editor-support/cocostudio/CCBatchNode.cpp b/cocos/editor-support/cocostudio/CCBatchNode.cpp index f441ade370..19465e4fea 100644 --- a/cocos/editor-support/cocostudio/CCBatchNode.cpp +++ b/cocos/editor-support/cocostudio/CCBatchNode.cpp @@ -147,7 +147,7 @@ void BatchNode::draw() void BatchNode::generateGroupCommand() { Renderer* renderer = Director::getInstance()->getRenderer(); - GroupCommand* groupCommand = GroupCommand::getCommandPool().generateCommand(); + GroupCommand* groupCommand = new GroupCommand(); groupCommand->init(0,_vertexZ); renderer->addCommand(groupCommand); diff --git a/cocos/editor-support/cocostudio/CCSkin.cpp b/cocos/editor-support/cocostudio/CCSkin.cpp index f408e7c4cc..38450ff900 100644 --- a/cocos/editor-support/cocostudio/CCSkin.cpp +++ b/cocos/editor-support/cocostudio/CCSkin.cpp @@ -219,7 +219,7 @@ void Skin::draw() kmGLGetMatrix(KM_GL_MODELVIEW, &mv); //TODO implement z order - QuadCommand* renderCommand = QuadCommand::getCommandPool().generateCommand(); + QuadCommand* renderCommand = new QuadCommand(); renderCommand->init(0, _vertexZ, _texture->getName(), _shaderProgram, _blendFunc, &_quad, 1, mv); Director::getInstance()->getRenderer()->addCommand(renderCommand); } diff --git a/samples/Cpp/TestCpp/Classes/ActionsTest/ActionsTest.cpp b/samples/Cpp/TestCpp/Classes/ActionsTest/ActionsTest.cpp index 66222daa7c..4470a7ea1f 100644 --- a/samples/Cpp/TestCpp/Classes/ActionsTest/ActionsTest.cpp +++ b/samples/Cpp/TestCpp/Classes/ActionsTest/ActionsTest.cpp @@ -1289,7 +1289,7 @@ void ActionFollow::onEnter() void ActionFollow::draw() { - CustomCommand* cmd = CustomCommand::getCommandPool().generateCommand(); + CustomCommand* cmd = new CustomCommand(); cmd->init(0, _vertexZ); cmd->func = CC_CALLBACK_0(ActionFollow::onDraw, this); @@ -1606,7 +1606,7 @@ void ActionCatmullRomStacked::draw() kmGLPopMatrix(); kmGLGetMatrix(KM_GL_MODELVIEW, &_modelViewMV2); - CustomCommand* cmd = CustomCommand::getCommandPool().generateCommand(); + CustomCommand* cmd = new CustomCommand(); cmd->init(0, _vertexZ); cmd->func = CC_CALLBACK_0(ActionCatmullRomStacked::onDraw, this); Director::getInstance()->getRenderer()->addCommand(cmd); @@ -1722,7 +1722,7 @@ void ActionCardinalSplineStacked::draw() kmGLGetMatrix(KM_GL_MODELVIEW, &_modelViewMV2); kmGLPopMatrix(); - CustomCommand* cmd = CustomCommand::getCommandPool().generateCommand(); + CustomCommand* cmd = new CustomCommand(); cmd->init(0, _vertexZ); cmd->func = CC_CALLBACK_0(ActionCardinalSplineStacked::onDraw, this); Director::getInstance()->getRenderer()->addCommand(cmd); @@ -2085,7 +2085,7 @@ void ActionCatmullRom::draw() kmGLPopMatrix(); kmGLGetMatrix(KM_GL_MODELVIEW, &_modelViewMV2); - CustomCommand* cmd = CustomCommand::getCommandPool().generateCommand(); + CustomCommand* cmd = new CustomCommand(); cmd->init(0, _vertexZ); cmd->func = CC_CALLBACK_0(ActionCatmullRom::onDraw, this); Director::getInstance()->getRenderer()->addCommand(cmd); @@ -2186,7 +2186,7 @@ void ActionCardinalSpline::draw() kmGLGetMatrix(KM_GL_MODELVIEW, &_modelViewMV2); kmGLPopMatrix(); - CustomCommand* cmd = CustomCommand::getCommandPool().generateCommand(); + CustomCommand* cmd = new CustomCommand(); cmd->init(0, _vertexZ); cmd->func = CC_CALLBACK_0(ActionCardinalSpline::onDraw, this); Director::getInstance()->getRenderer()->addCommand(cmd); diff --git a/samples/Cpp/TestCpp/Classes/Box2DTest/Box2dTest.cpp b/samples/Cpp/TestCpp/Classes/Box2DTest/Box2dTest.cpp index b02af726c2..a0fc2c6298 100644 --- a/samples/Cpp/TestCpp/Classes/Box2DTest/Box2dTest.cpp +++ b/samples/Cpp/TestCpp/Classes/Box2DTest/Box2dTest.cpp @@ -149,7 +149,7 @@ void Box2DTestLayer::draw() kmGLPushMatrix(); kmGLGetMatrix(KM_GL_MODELVIEW, &_modelViewMV); - CustomCommand *cmd = CustomCommand::getCommandPool().generateCommand(); + CustomCommand *cmd = new CustomCommand(); cmd->init(0, _vertexZ); cmd->func = CC_CALLBACK_0(Box2DTestLayer::onDraw, this); Director::getInstance()->getRenderer()->addCommand(cmd); diff --git a/samples/Cpp/TestCpp/Classes/DrawPrimitivesTest/DrawPrimitivesTest.cpp b/samples/Cpp/TestCpp/Classes/DrawPrimitivesTest/DrawPrimitivesTest.cpp index 9fe6f6c3fe..152ee7dbda 100644 --- a/samples/Cpp/TestCpp/Classes/DrawPrimitivesTest/DrawPrimitivesTest.cpp +++ b/samples/Cpp/TestCpp/Classes/DrawPrimitivesTest/DrawPrimitivesTest.cpp @@ -116,7 +116,7 @@ DrawPrimitivesTest::DrawPrimitivesTest() void DrawPrimitivesTest::draw() { - CustomCommand * cmd = CustomCommand::getCommandPool().generateCommand(); + CustomCommand * cmd = new CustomCommand(); cmd->init(0, _vertexZ); cmd->func = CC_CALLBACK_0(DrawPrimitivesTest::onDraw, this); Director::getInstance()->getRenderer()->addCommand(cmd); diff --git a/samples/Cpp/TestCpp/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp b/samples/Cpp/TestCpp/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp index f1afd308cd..a574e8f15b 100644 --- a/samples/Cpp/TestCpp/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp +++ b/samples/Cpp/TestCpp/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp @@ -1094,7 +1094,7 @@ std::string TestBoundingBox::title() const } void TestBoundingBox::draw() { - CustomCommand *cmd = CustomCommand::getCommandPool().generateCommand(); + CustomCommand *cmd = new CustomCommand(); cmd->init(0, _vertexZ); cmd->func = CC_CALLBACK_0(TestBoundingBox::onDraw, this); Director::getInstance()->getRenderer()->addCommand(cmd); diff --git a/samples/Cpp/TestCpp/Classes/LabelTest/LabelTest.cpp b/samples/Cpp/TestCpp/Classes/LabelTest/LabelTest.cpp index 09280e9b63..8fb6ea43a4 100644 --- a/samples/Cpp/TestCpp/Classes/LabelTest/LabelTest.cpp +++ b/samples/Cpp/TestCpp/Classes/LabelTest/LabelTest.cpp @@ -209,7 +209,7 @@ void Atlas1::draw() // GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY // GL_TEXTURE_2D - CustomCommand *cmd = CustomCommand::getCommandPool().generateCommand(); + CustomCommand *cmd = new CustomCommand(); cmd->init(0, _vertexZ); cmd->func = CC_CALLBACK_0(Atlas1::onDraw, this); Director::getInstance()->getRenderer()->addCommand(cmd); @@ -526,7 +526,7 @@ Atlas4::Atlas4() void Atlas4::draw() { - CustomCommand *cmd = CustomCommand::getCommandPool().generateCommand(); + CustomCommand *cmd = new CustomCommand(); cmd->init(0, _vertexZ); cmd->func = CC_CALLBACK_0(Atlas4::onDraw, this); Director::getInstance()->getRenderer()->addCommand(cmd); @@ -1613,7 +1613,7 @@ std::string LabelBMFontBounds::subtitle() const void LabelBMFontBounds::draw() { - CustomCommand *cmd = CustomCommand::getCommandPool().generateCommand(); + CustomCommand *cmd = new CustomCommand(); cmd->init(0, _vertexZ); cmd->func = CC_CALLBACK_0(LabelBMFontBounds::onDraw, this); Director::getInstance()->getRenderer()->addCommand(cmd); diff --git a/samples/Cpp/TestCpp/Classes/RenderTextureTest/RenderTextureTest.cpp b/samples/Cpp/TestCpp/Classes/RenderTextureTest/RenderTextureTest.cpp index 096a7899f9..c3478551cb 100644 --- a/samples/Cpp/TestCpp/Classes/RenderTextureTest/RenderTextureTest.cpp +++ b/samples/Cpp/TestCpp/Classes/RenderTextureTest/RenderTextureTest.cpp @@ -589,7 +589,7 @@ SpriteRenderTextureBug::SimpleSprite* SpriteRenderTextureBug::SimpleSprite::crea void SpriteRenderTextureBug::SimpleSprite::draw() { - CustomCommand *cmd = CustomCommand::getCommandPool().generateCommand(); + CustomCommand *cmd = new CustomCommand(); cmd->init(0, _vertexZ); cmd->func = CC_CALLBACK_0(SpriteRenderTextureBug::SimpleSprite::onBeforeDraw, this); Director::getInstance()->getRenderer()->addCommand(cmd); diff --git a/samples/Cpp/TestCpp/Classes/ShaderTest/ShaderTest.cpp b/samples/Cpp/TestCpp/Classes/ShaderTest/ShaderTest.cpp index d3b1565d01..d93a0c1e83 100644 --- a/samples/Cpp/TestCpp/Classes/ShaderTest/ShaderTest.cpp +++ b/samples/Cpp/TestCpp/Classes/ShaderTest/ShaderTest.cpp @@ -196,7 +196,7 @@ void ShaderNode::setPosition(const Point &newPosition) void ShaderNode::draw() { - CustomCommand *cmd = CustomCommand::getCommandPool().generateCommand(); + CustomCommand *cmd = new CustomCommand(); cmd->init(0, _vertexZ); cmd->func = CC_CALLBACK_0(ShaderNode::onDraw, this); Director::getInstance()->getRenderer()->addCommand(cmd); @@ -532,7 +532,7 @@ void SpriteBlur::initProgram() void SpriteBlur::draw() { - CustomCommand *cmd = CustomCommand::getCommandPool().generateCommand(); + CustomCommand *cmd = new CustomCommand(); cmd->init(0, _vertexZ); cmd->func = CC_CALLBACK_0(SpriteBlur::onDraw, this); Director::getInstance()->getRenderer()->addCommand(cmd);