From cd00de572d60704ca031070c47444a4e73939cf8 Mon Sep 17 00:00:00 2001 From: huangshiwu Date: Thu, 29 Jan 2015 18:06:20 +0800 Subject: [PATCH] add glBindBuffer for drawnode and clippingnode to avoid crash --- cocos/2d/CCClippingNode.cpp | 3 ++- cocos/2d/CCDrawNode.cpp | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cocos/2d/CCClippingNode.cpp b/cocos/2d/CCClippingNode.cpp index 4cb2180915..de31dba134 100644 --- a/cocos/2d/CCClippingNode.cpp +++ b/cocos/2d/CCClippingNode.cpp @@ -218,7 +218,8 @@ void ClippingNode::drawFullScreenQuadClearStencil() glProgram->use(); glProgram->setUniformsForBuiltins(); glProgram->setUniformLocationWith4fv(colorLocation, (GLfloat*) &color.r, 1); - + + glBindBuffer(GL_ARRAY_BUFFER, 0); GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION ); glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices); glDrawArrays(GL_TRIANGLE_FAN, 0, 4); diff --git a/cocos/2d/CCDrawNode.cpp b/cocos/2d/CCDrawNode.cpp index 91cd48152e..e72f5c9e21 100644 --- a/cocos/2d/CCDrawNode.cpp +++ b/cocos/2d/CCDrawNode.cpp @@ -274,6 +274,8 @@ bool DrawNode::init() glGenBuffers(1, &_vboGLPoint); glBindBuffer(GL_ARRAY_BUFFER, _vboGLPoint); glBufferData(GL_ARRAY_BUFFER, sizeof(V2F_C4B_T2F)*_bufferCapacityGLPoint, _bufferGLPoint, GL_STREAM_DRAW); + + glBindBuffer(GL_ARRAY_BUFFER, 0); } CHECK_GL_ERROR_DEBUG();