cocos2d-x在android上call to OpenGL ES API with no current context
来源:互联网 发布:淘宝有哪些正品代购店 编辑:程序博客网 时间:2024/06/06 01:22
一、出现的问题:
在使用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);
}
});
}
0 0
- cocos2d-x在android上call to OpenGL ES API with no current context
- [cocos2d-x] android jni call to OpenGL ES API with no current context
- 【cocos2d-x 025】 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)
- ANDROID “call to opengl es api with no current context”错误的解决
- ANDROID “call to opengl es api with no current context”错误的解决
- 解决COCOS2D-X与JNI交互游戏出现崩溃的问题call to OpenGL ES API with no current context (logged once per thread)
- 关于LGame中的call to OpenGL ES API with no current context
- webView 播放SWF 引起call to OpenGL ES API with no current context错误
- cocos2dx- 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 错误及解决方案
- 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)
- call to OpenGL ES API with no current context (logged once per thread)
- [iuud8]cocos2dx项目编译到安卓报call to OpenGL ES API with no current context的错误
- call to OpenGL ES API with no current context 和Fatal signal 11
- 关键字retain copy assign nonatomic property synthesize
- HDU1241
- python类继承时构造函数的执行问题
- SSD 硬盘使用注意事项
- C语言中的强制类型转换
- cocos2d-x在android上call to OpenGL ES API with no current context
- 用Servlet、JSP实现帐号注册页面,用过滤器过滤对象防止中文乱码
- Netty实现原理浅析
- 黑马程序员——面向对象的基本概念知识
- 使用Artful MySQL模块出错
- Algorithm学习笔记 --- ACM算法分类
- 计算机专业学习浅谈
- Mysql绿色版安装配置说明
- MFC中为窗口添加位图背景,避免屏幕闪烁1