1

After showing + closing an ad from Mopub in a Cocos2d-x 3.0 Android game, logcat shows these errors:

E/libEGL  (13772): call to OpenGL ES API with no current context (logged once per thread)

W/Adreno-ES20(13772): <core_glBufferSubData:1238>: GL_INVALID_VALUE
D/cocos2d-x debug info(13772): OpenGL error 0x0501 in snip/../cocos2d/cocos/2d/CCTextureAtlas.cpp drawNumberOfQuads 123

D/cocos2d-x debug info(13772): 
W/Adreno-ES20(13772): <core_glBufferSubData:1238>: GL_INVALID_VALUE
D/cocos2d-x debug info(13772): OpenGL error 0x0501 in snip/../cocos2d/cocos/2d/CCTextureAtlas.cpp drawNumberOfQuads 123

D/cocos2d-x debug info(13772): 
W/Adreno-ES20(13772): <core_glBufferSubData:1238>: GL_INVALID_VALUE
D/cocos2d-x debug info(13772): OpenGL error 0x0501 in snip/../cocos2d/cocos/2d/CCTextureAtlas.cpp drawNumberOfQuads 123

How can I display the ads in their own view such that the context isn't lost?

More info:

  • Some drawing bugs happen with these errors. Mostly just missing labels.
  • the app doesn't crash
  • adding this.setPreserveEGLContextOnPause(true) to Cocos2dxGLSurfaceView's initView doesn't seem to help
  • I tried pausing + stopping animation before ad is shown, then starting animation and resuming after ad is dismissed. This didn't seem to help.
  • I'm calling moPubInterstitial.show() from the UI thread
  • I'm calling moPubInterstitial.load() from the UI thread
  • I received OpenGL error 0x0502 at some point (probably before trying above fixes)
SundayMonday
  • 19,147
  • 29
  • 100
  • 154

1 Answers1

0

Found useful info here: https://gamedev.stackexchange.com/questions/12629/workaround-to-losing-the-opengl-context-when-android-pauses

However, the "solution" was to avoid any use of the NotificationCenter in the pause/resume JNI calls from Java to c++. Not sure if this is a Cocos2d-x bug. I'm using cocos2d-x-3.0rc1 April.2 2014.

Community
  • 1
  • 1
SundayMonday
  • 19,147
  • 29
  • 100
  • 154