android opengl: createWindowSurface returned EGL_BAD_NATIVE_WINDOW.
来源:互联网 发布:麻辣it 编辑:程序博客网 时间:2024/06/03 17:43
我擦了,这个问题真是个老大难。
我使用的设备是一个三星的pad,2.2系统,型号忘了,反正是之前很流行的一个设备。
尼玛系统文档说好了2.2是支持opengl的呀,肿么就创建window失败呢,百思不得其解啊
折腾了两天呀,最后终于被我发现了苗头了。
我的代码这么写的(代码编译不过了,有些东西被我删了,您就别copy了)
public class MyGLSurface extends GLSurfaceView
{
private TCGLRender mMyGLRender;
public MyGLSurface(Context context, AttributeSet attrs) {
super(context, attrs);
if (getGLVersion(context) == 2) {
mIsSupportGLV2 = true;
}
if (mIsSupportGLV2) {
this.setEGLContextClientVersion(2);
}
mMyGLRender = new TCGLRender(mIsSupportGLV2, mBufFreeSem);
mMyGLRender.setContext(context);
this.setRenderer(mMyGLRender);
this.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
}
public void onPause() {
super.onPause();
}
public void onResume() {
super.onResume();
}
public void DrawFrame(byte[] ydatas, byte[] udatas, byte[] vdatas,
int width, int height, int dstWidth, int dstHeight, float degree,
boolean isFull)
{
mMyGLRender.CopyFrame2Render(ydatas, udatas, vdatas, width, height, dstWidth, dstHeight, degree, isFull);
this.requestRender();
}
static public int getGLVersion(Context context) {
ActivityManager am = (ActivityManager) context
.getSystemService(Context.ACTIVITY_SERVICE);
ConfigurationInfo info = am.getDeviceConfigurationInfo();
return (info.reqGlEsVersion >= 0x00020000) ? 2 : 1;
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
{
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
this.setMeasuredDimension(widthMeasureSpec, heightMeasureSpec);
}
}
看到没有,红色的部分就是特么的罪魁祸首了,我揣测2.2系统里面GLSurfaceView里面没有这个方法,所以一直override之后就有问题了
把他删掉就OK了
类似的,可能类似的问题也呼导致这个 EGL_BAD_NATIVE_WINDOW的错误,大家出现的时候可以关注一下
OK,打完收工
- android opengl: createWindowSurface returned EGL_BAD_NATIVE_WINDOW.
- 获取GPU信息 --createWindowSurface EGL_BAD_NATIVE_WINDOW -- failed: EGL_BAD_MATCH
- Android createWindowSurface failed EGL_BAD_ALLOC 引起Crash的解决方案
- Android createWindowSurface failed EGL_BAD_ALLOC 引起Crash的解决方案
- Android SkImageDecoder::Factory returned null
- Android: SkImageDecoder:: Factory returned null
- android Couldn't load ** findLibrary returned null
- android opengl
- android opengl
- Android OpenGL
- Android-OpenGL
- Android OpenGL
- Android:OpenGL
- Android OpenGL
- android 混淆错误 Proguard returned with error code 1
- Android 编译错误:collect2: ld returned 1 exit status
- Jenkins Error: android: $GERRIT_REFSPEC" returned status code 128
- android: java was started but returned exit code = 1
- HTTP 协议详解
- Android学习网站
- Apache-XMLRrpc-3.1.3加入日志监听器
- android之AndroidManifest.xml简述
- android 相机 前后摄像头判断
- android opengl: createWindowSurface returned EGL_BAD_NATIVE_WINDOW.
- 为什么需要Class.forName("com.mysql.jdbc.Driver")
- 在struts2中使用tiles框架
- Vim 配置详解
- ORACLE 10g下载|ORACLE 10g下载地址|ORACLE 10g官网下载地址
- 查找命令find locate which whereis
- JavaScript图片拖动效果(ondragstart和ondrag)
- 调整Dataguard环境的Online和Standby Redo Log
- 逗号表达式