Skip to content

Commit 835fec0

Browse files
deflinhecminggo
authored andcommitted
fix OpenGL ERROR 0x0502 cannot delete VAO 0 (#20178)
1 parent a500e7f commit 835fec0

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

cocos/2d/CCParticleSystemQuad.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -545,10 +545,15 @@ void ParticleSystemQuad::setTotalParticles(int tp)
545545

546546
void ParticleSystemQuad::setupVBOandVAO()
547547
{
548-
// clean VAO
549548
glDeleteBuffers(2, &_buffersVBO[0]);
550-
glDeleteVertexArrays(1, &_VAOname);
551-
GL::bindVAO(0);
549+
550+
// clean VAO
551+
if (_VAOname)
552+
{
553+
glDeleteVertexArrays(1, &_VAOname);
554+
GL::bindVAO(0);
555+
_VAOname = 0;
556+
}
552557

553558
glGenVertexArrays(1, &_VAOname);
554559
GL::bindVAO(_VAOname);

0 commit comments

Comments
 (0)