[SOLVED] 3.0beta2 error on resume

@zhangxm
I sent you another email with my real project in it. Hope we can fix it…

Is it related to this bug?
http://www.cocos2d-x.org/issues/4057

With respect to your attach file, i didn’t see any activity class with egl initialization just the appdelegate with just the instance of it.

On v3.0, we use native activity.

@newstar55a
I know right… all NativeActivity code is written in cpp. That’s why I’m confused because it’s different than usual initialization which includes GLSurfaceView. So is there workaround on this?

@siauw
I’m running your sample project. Now I have reproduced the problem.
And I will reply in this topic once I found some clues.

After some searching on google it seems the problem is only happened when using opegl es 2 on adreno 200 series.

What’s the key word you searched? <qgl2DrvAPI_glDrawElementsInstancedXXX:689>: GLINVALIDVALUE
This one?

I found if close the FPS output, the errors in logcat : “CCTextureAtlas.cpp drawNumberOfQuads 701” will not output anymore.
But the app always crashed. So I think the GL errors are not the real reason of crash.

@zhangbin
I searched “adreno200 crash on resume”, you will get pages with similar issues with this on all other graphic engine.
http://comments.gmane.org/gmane.comp.lib.sdl/64140
https://developer.qualcomm.com/forum/qdevnet-forums/mobile-gaming-graphics-optimization-adreno/11525

I tried a game made with cocos2d-x “Run Cow Run”, there is no problem at all like this, it seems the developer @Obg1 managed to fix the problem.

If I remove director->setDisplayStats(true) on AppDelegate, I got this error instead

02-25 14:39:21.709: E/dalvikvm(25375): JNI ERROR: env->self != thread-self (0xa3b970 vs. 0xec3718); auto-correcting

Hi, @siauw.
I found the reason of the crash:

void MainMenu::onPlay( Object *pSender, gui::TouchEventType type)
{
	// this line caused the crash, because it removed the event listeners in engine.
	this->_eventDispatcher->removeAllEventListeners();

	CCLOG("play clicked");
	Director::getInstance()->replaceScene(PlayState::createScene());

	cleanUp();
}

There is a new issue to handle the problem: http://www.cocos2d-x.org/issues/4129
Before it’s fixed, you can solve the problem by remove the code : removeAllEventListeners().
Thanks for your feedback!:slight_smile:

siauw wrote:

@newstar55a
I know right… all NativeActivity code is written in cpp. That’s why I’m confused because it’s different than usual initialization which includes GLSurfaceView. So is there workaround on this?

Oh i see :slight_smile:
But no matter whether it’s NativeActivity or android’s activity im sure there’s an EGL code somewhere? This is becoming interesting for me now im curious how EGL was initialize.
But i notice on the appdelegate you have an instance of the egl right? how about look at the available methods there?

@zhangbin
Thanks your solution works… :slight_smile: I thought there was something wrong with the renderer, but it’s not :slight_smile:

@newstar55a
Thanks for your help also. I still don’t find anything related to GLSurfaceView from EGLView.

Cool…
You may want to edit your title thread and put a “[SOLVED]” mark?
this way others would know that this issue is resolve.

zhangbin wrote:

Hi, @siauw.
I found the reason of the crash:

void MainMenu::onPlay( Object *pSender, gui::TouchEventType type)
{
	// this line caused the crash, because it removed the event listeners in engine.
	this->_eventDispatcher->removeAllEventListeners();

	CCLOG("play clicked");
	Director::getInstance()->replaceScene(PlayState::createScene());

	cleanUp();
}

There is a new issue to handle the problem: http://www.cocos2d-x.org/issues/4129
Before it’s fixed, you can solve the problem by remove the code : removeAllEventListeners().
Thanks for your feedback!:slight_smile:

fixed at https://github.com/cocos2d/cocos2d-x/pull/5492