cocos2dx- call to OpenGL ES API with no current context(logged once per thread)
2015-02-07 10:41
531 查看
一、出现的问题: 在使用JNI从Java(Android)侧 回调C++(Cocos2d-x)的函数返回消息,Cocos2d-x上的界面给花掉了 看看 Eclipse的Log中,显示
一、出现的问题:
在使用JNI从Java(Android)侧 回调C++(Cocos2d-x)的函数返回消息,Cocos2d-x上的界面给花掉了
看看 Eclipse的Log中,显示 有 call to OpenGL ES API with no current context (logged once per thread) 的错误
二、解决方案:
经过查找资料了解到这个问题是因为Android在启动cocos2d-x的Thread时,没有用context的主的Thread,而是使用的OpenGL的Thread, 所以我们不能在主Thread去完成 本应该是在cocos2dx中OpenGL Thread中 完成的工作(即所调用的函数在Cocos2dx中做的工作)
必须使用OpenGL的Thread去完成︰
Java(Android)侧-Cocos2dxActivity.java
应该在Cocos2dxActivty的这个Activity用runOnGLThread去完成对应的工作
public static native void nativeCallback(String code, String params);
public static void runNativeCallback(final String code, final String params)
{
Cocos2dxGLSurfaceView.getInstance().queueEvent(new Runnable() {
@Override
public void run() {
nativeCallback(code, params);
}
});
}
原文地址:http://www.le4.cn/android/1632.html
一、出现的问题:
在使用JNI从Java(Android)侧 回调C++(Cocos2d-x)的函数返回消息,Cocos2d-x上的界面给花掉了
看看 Eclipse的Log中,显示 有 call to OpenGL ES API with no current context (logged once per thread) 的错误
二、解决方案:
经过查找资料了解到这个问题是因为Android在启动cocos2d-x的Thread时,没有用context的主的Thread,而是使用的OpenGL的Thread, 所以我们不能在主Thread去完成 本应该是在cocos2dx中OpenGL Thread中 完成的工作(即所调用的函数在Cocos2dx中做的工作)
必须使用OpenGL的Thread去完成︰
Java(Android)侧-Cocos2dxActivity.java
应该在Cocos2dxActivty的这个Activity用runOnGLThread去完成对应的工作
public static native void nativeCallback(String code, String params);
public static void runNativeCallback(final String code, final String params)
{
Cocos2dxGLSurfaceView.getInstance().queueEvent(new Runnable() {
@Override
public void run() {
nativeCallback(code, params);
}
});
}
原文地址:http://www.le4.cn/android/1632.html
相关文章推荐
- cocos2dx- call to OpenGL ES API with no current context(logged once per thread)
- cocos2dx- call to OpenGL ES API with no current context(logged once per thread)
- cocos2dx- call to OpenGL ES API with no current context(logged once per thread)
- cocos2dx- call to OpenGL ES API with no current context(logged once per thread)
- cocos2dx- call to OpenGL ES API with no current context(logged once per thread)
- OpenGL ES开发中遇到call to OpenGL ES API with no current context (logged once per thread) 问题原因
- Android: call to OpenGL ES API with no current context (logged once per thread)
- call to OpenGL ES API with no current context (logged once per thread)可能会导致加载问题?
- call to OpenGL ES API with no current context (logged once per thread)
- call to OpenGL ES API with no current context (logged once per thread)
- 【cocos2d-x 025】 call to OpenGL ES API with no current context (logged once per thread)
- 解决COCOS2D-X与JNI交互游戏出现崩溃的问题call to OpenGL ES API with no current context (logged once per thread)
- call to OpenGL ES API with no current context (logged once per thread)
- call to OpenGL ES API with no current context (logged once per thread)
- JNI error:libEGL: call to OpenGL ES API with no current context (logged once per
- 关于LGame中的call to OpenGL ES API with no current context
- call to OpenGL ES API with no current context 错误及解决方案
- call to OpenGL ES API with no current context 和Fatal signal 11
- cocos2d-x于android在call to OpenGL ES API with no current context
- call to OpenGL ES API with no current context 和Fatal signal 11