OpenGL error 0x0500 in -[EAGLView swapBuffers]

My appeared on iOS as well, dont know if the same happens on android because i havent checked out the console yet.

I am getting this error every time I load a CCParticleSystemQuad into a scene with a CCParallaxNode in the background. If I take out the CCParallaxNode, the error goes away and everything is smooth. If I add the CCParallaxNode back in, the error comes back, the whole screen flickers, and “blank” squares start appearing over all of the nodes in the scene. I’ve tried all of the tricks I can find online, but nothing seems to work. Any help would be appreciated. This is all on iOS. The same code crashes Android when the CCParallaxNode is added.

I have a case as same as what Brandon Dorris mentioned in iOS

I have the same issue.

Might be related to ccparallaxnode, since i use it in my game and have the same error as well.

But both iOS and Android do not crash and everything appears to be normal. The game runs at > 50 fps on both devices. I only use Box2d, ccparallax, and sprites, but i do use a lot of textures (3 x 2048x2048) and audio.

I assumed it was the CCParallaxNode as well. I can put just one relatively small background image in the parallax node and produce the same symptoms. This “OpenGL error 0x0500” was the only other thing that showed up along with the screen flickering and missing squares.

Sorry guys, it seems a bug. Could any one upload a simple project reproducing this error, so we can fix it quickly?
Bug #974 is created.

I can upload a simple project here in a few hours.

here is a sample.

CCParticleMeteor* meteor = CCParticleMeteor::node();
meteor~~>setPosition);
meteor~~>setTexture( CCTextureCache::sharedTextureCache()>addImage );
this
>addChild(meteor);

Is it the same as http://www.cocos2d-x.org/boards/7/topics/5737?r=7714?

No, that seems like a very different problem. The real problem here for me is that the CCParallaxNode seems to cause issues when other sprites (or particles) are drawn on top of it. The screen flickers a bit and small squares are missing from large portions of the screen. I have attached a screenshot to show what I mean.

I’m actually able to reproduce this with a single CCParallaxNode. Here is the code:

CCSize size = CCDirector::sharedDirector()->getWinSize();

space = CCParallaxNode::node(); space->setPosition(ccp(0, 0));

CCSprite *stars3 = CCSprite::spriteWithFile("Starfield3.png"); space->addChild(stars3, 0, ccp(-1, 2), ccp(0, 0)); CCSprite *stars2 = CCSprite::spriteWithFile("Starfield2.png"); stars2->setAnchorPoint(ccp(0,0)); space->addChild(stars2, 1, ccp(-2, 4), ccp(0, 0)); CCSprite *stars1 = CCSprite::spriteWithFile("Starfield1.png"); stars1->setAnchorPoint(ccp(0,0)); space->addChild(stars1, 2, ccp(-4, 8), ccp(0, 0));

CCSprite *grid = CCSprite::spriteWithFile("HexGrid.png"); grid->setAnchorPoint(ccp(0,0)); CCSize gridSize = grid->getContentSize(); space->addChild(grid, 3, ccp(-10, 20), ccp(0, 0));

this->addChild(space);

CCMoveBy *moveLeft = CCMoveBy::actionWithDuration(5.0, ccp(200, 0)); CCMoveBy *moveRight = CCMoveBy::actionWithDuration(5.0, ccp(-200, 0));

CCSequence *sequence = CCSequence::actionOneTwo(moveLeft, moveRight); CCRepeatForever *repeat = CCRepeatForever::actionWithAction(sequence);

space->runAction(repeat);

The files are here: http://lts.cr/Bayt

OpenGL error 0x0500 generated if you not call CCSprite::init() from child of CCSprite.
Error raised by method
glBlendFunc(m_sBlendFunc.src, m_sBlendFunc.dst);
in
CCSprite::draw(void)
because m_sBlendFunc not initialised and filled with trash.
(P.S. Sorry for my rude English)

My issue actually turned out to be the one mentioned here: http://www.cocos2d-x.org/news/24 . After adding CCDirector::sharedDirector()->setDepthTest(false);, everything was fixed. I was just thrown off by the OpenGL error message in the logs.

I’m getting this error too, however it’s when utilising CCParticleSystem, following the test included in the repo.

I’m initialising it like so:

    emitter = cocos2d::CCParticleSmoke::node();
    addChild(emitter, SMOKE);

    emitter->setTexture(cocos2d::CCTextureCache::sharedTextureCache()->addImage(smoke.c_str()));

    emitter->setEndColor(cocos2d::ccc4FFromccc4B(cocos2d::ccc4(0, 0, 0, 0)));

This occurs each time this block of code is run. I’ve attempted to manually set the blend mode on the emitter which didn’t work (I doubted it would as it appears to be initialised in the constructor) any further thoughts on this matter?

I meet the same issue as Nic D when I use CCParticleSystem.
I know you are very busy for 2,0. Hope #974 it can ben resolved in the .13

Has this error been fixed?

Žygis Buzzy wrote:

Has this error been fixed?

Error is not fixed
Here is the problem:

#if CC_USES_VBO
glEnable(GL_VERTEX_ARRAY);

// create the VBO buffer
glGenBuffers(1, &m_uQuadsID);

// initial binding
glBindBuffer(GL_ARRAY_BUFFER, m_uQuadsID);
glBufferData(GL_ARRAY_BUFFER, sizeof(m_pQuads[0])*m_uTotalParticles, m_pQuads, GL_DYNAMIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);
#endif

#if CC_USES_VBO
glDeleteBuffers(1, &m_uQuadsID);
#endif

If you correct #define CC_USES_VBO 1 to #define CC_USES_VBO 0 in ccConfig.h, this bug will not appear.

In CCParticleSystemQuad

change

glEnable(GL_VERTEX_ARRAY);

to
glEnableClientState(GL_VERTEX_ARRAY);

cocos2dx - 1.0.12

in iOS simulator it’s reproduced more often when the simulator window is back