【问题标题】:Displaying ads above GLSurfaceView in Cocos2d-x on AndroidAndroid Cocos2d-x 中 GLSurfaceView 上方显示广告
【发布时间】:2014-10-08 15:59:26
【问题描述】:

在 Cocos2d-x 3.0 Android 游戏中显示 + 关闭来自 Mopub 的广告后,logcat 显示以下错误:

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

我怎样才能在他们自己的视图中显示广告,以免丢失上下文?

更多信息:

  • 这些错误会导致一些绘图错误。大多只是缺少标签。
  • 应用不会崩溃
  • this.setPreserveEGLContextOnPause(true) 添加到 Cocos2dxGLSurfaceView 的 initView 似乎没有帮助
  • 我尝试在显示广告之前暂停 + 停止动画,然后在广告关闭后开始动画并恢复。这似乎没有帮助。
  • 我正在从 UI 线程调用 moPubInterstitial.show()
  • 我正在从 UI 线程调用 moPubInterstitial.load()
  • 我在某个时候收到了OpenGL error 0x0502(可能在尝试上述修复之前)

【问题讨论】:

    标签: android opengl-es cocos2d-x mopub openglcontext


    【解决方案1】:

    在这里找到有用的信息:https://gamedev.stackexchange.com/questions/12629/workaround-to-losing-the-opengl-context-when-android-pauses

    但是,“解决方案”是避免在从 Java 到 c++ 的暂停/恢复 JNI 调用中使用 NotificationCenter。不确定这是否是 Cocos2d-x 错误。我正在使用cocos2d-x-3.0rc1 April.2 2014

    【讨论】:

      猜你喜欢
      • 2012-09-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多