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'sinitView
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)