mirror of https://github.com/axmolengine/axmol.git
Merge pull request #8077 from huangshiwu/v3_test
fix ClippingNode's memory leak bug
This commit is contained in:
commit
98a85fd635
|
@ -221,15 +221,8 @@ void ClippingNode::drawFullScreenQuadClearStencil()
|
|||
glProgram->setUniformLocationWith4fv(colorLocation, (GLfloat*) &color.r, 1);
|
||||
|
||||
GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION );
|
||||
|
||||
GLuint vbo;
|
||||
glGenBuffers(1, &vbo);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbo);
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(Vec2)*4, vertices, GL_STREAM_DRAW);
|
||||
|
||||
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, 0);
|
||||
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices);
|
||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, 4);
|
||||
|
||||
|
|
|
@ -698,15 +698,9 @@ void RawStencilBufferTest::onBeforeDrawClip(int planeIndex, const Vec2& pt)
|
|||
glProgram->setUniformLocationWith4fv(colorLocation, (GLfloat*) &color.r, 1);
|
||||
|
||||
GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION );
|
||||
|
||||
GLuint vbo;
|
||||
glGenBuffers(1, &vbo);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbo);
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(Vec2)*4, vertices, GL_STREAM_DRAW);
|
||||
|
||||
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, 0);
|
||||
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices);
|
||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, 4);
|
||||
}
|
||||
|
@ -715,7 +709,7 @@ void RawStencilBufferTest::onBeforeDrawSprite(int planeIndex, const Vec2& pt)
|
|||
{
|
||||
this->setupStencilForDrawingOnPlane(planeIndex);
|
||||
CHECK_GL_ERROR_DEBUG();
|
||||
|
||||
|
||||
Vec2 vertices[] = {
|
||||
Vec2::ZERO,
|
||||
Vec2(pt.x, 0),
|
||||
|
@ -736,14 +730,8 @@ void RawStencilBufferTest::onBeforeDrawSprite(int planeIndex, const Vec2& pt)
|
|||
|
||||
GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION );
|
||||
|
||||
GLuint vbo;
|
||||
glGenBuffers(1, &vbo);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbo);
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(Vec2)*4, vertices, GL_STREAM_DRAW);
|
||||
|
||||
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, 0);
|
||||
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices);
|
||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, 4);
|
||||
}
|
||||
|
@ -944,14 +932,8 @@ void RawStencilBufferTest6::setupStencilForClippingOnPlane(GLint plane)
|
|||
|
||||
GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION );
|
||||
|
||||
GLuint vbo;
|
||||
glGenBuffers(1, &vbo);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbo);
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(Vec2)*4, vertices, GL_STREAM_DRAW);
|
||||
|
||||
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, 0);
|
||||
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices);
|
||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, 4);
|
||||
|
||||
|
|
Loading…
Reference in New Issue