[iuud8]cocos2dx项目编译到安卓报call to OpenGL ES API with no current context的错误
来源:互联网 发布:数据定义语言包括什么 编辑:程序博客网 时间:2024/06/05 17:13
话说最近真是写了好多小游戏。。。然后编译到android,然后就各种出错了。。。有一个比较头疼的问题,改了好久没改出来
具体问题如下:
c++通过jni调用android没有问题,但是当android通过jni调用c++时候,如果涉及到c++方面ui的变动,则会报下面的error
01-28 11:44:45.264: E/libEGL(23655): call to OpenGL ES API with no current context (logged once per thread)
这个问题会导致ui上图片不能正确的显示,或黑框,或直接崩溃。。。
话说真是困扰了好久,连重建项目这种事情我都干了。。。
在网上搜了资料,发现了以下解释:
OpenGL是一个其于上下文Context 环境开发的,所以每个线程需要保存自已的运行环境,如果没有的话则会报错:"call to OpenGL ES API with no current context logged once per thread"
解决方法如下:
例如我们原来调用c++的函数是这么调用的:
//声明public static native void buySuccess(String GoodsType);//调用AppActivity.buySuccess("aa");
则我们需要改为这种方式调用
//声明public static native void buySuccess(String GoodsType);//调用buySuccessJava("aa");public void buySuccessJava(final String GoodsType) { Cocos2dxGLSurfaceView.getInstance().queueEvent(new Runnable() { @Override public void run() { buySuccess(GoodsType); } }); }
保存运行,发现已经OK
0 0
- [iuud8]cocos2dx项目编译到安卓报call to OpenGL ES API with no current context的错误
- ANDROID “call to opengl es api with no current context”错误的解决
- ANDROID “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)
- 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)
- webView 播放SWF 引起call to OpenGL ES API with no current context错误
- call to OpenGL ES API with no current context 错误及解决方案
- 关于LGame中的call to OpenGL ES API with no current context
- Android: call to OpenGL ES API with no current context (logged once per thread)
- cocos2d-x在android上call to OpenGL ES API with no current context
- call to OpenGL ES API with no current context (logged once per thread)
- [cocos2d-x] android jni call to OpenGL ES API with no current context
- 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)
- 黑马程序员_异常
- Linux笔记(七)-用户和用户组管理
- 不是技术牛人,如何拿到国内IT巨头的Offer
- Android获取应用信息判断网络连接返回桌面及卸载apk结束进程等的实现思路
- 最简单的基于FFmpeg的内存读写的例子:内存转码器
- [iuud8]cocos2dx项目编译到安卓报call to OpenGL ES API with no current context的错误
- Android.mk 说明
- C语言文件操作解析(四)
- PowerDesigner的简单使用
- input 输入金额自动补上逗号
- iap内购 无法连接到 iTunes Store (拿坑砸自己)
- 数字图像处理,图像的伪彩色处理
- SQL Server 2008附加数据库提示5120错误解决
- c++中对文本的操作(转)