简体   繁体   English

createContext失败:EGL_SUCCESS

[英]createContext failed: EGL_SUCCESS

The log says 日志说

 java.lang.RuntimeException: createContext failed: EGL_SUCCESS
        at android.opengl.GLSurfaceView$EglHelper.throwEglException(GLSurfaceView.java:1193)
        at android.opengl.GLSurfaceView$EglHelper.throwEglException(GLSurfaceView.java:1184)
        at android.opengl.GLSurfaceView$EglHelper.start(GLSurfaceView.java:1034)
        at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1401)
        at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)

when I try to use the Rajawali library on Android studio. 当我尝试在Android Studio上使用Rajawali库时。 I found out that the problem must be device-capability-specific, because my app runs on other devices (Samsung Galaxy Tab 4, Nexus) but not on Sony Xperia LT30p. 我发现问题一定是特定于设备功能的,因为我的应用程序可以在其他设备(Samsung Galaxy Tab 4,Nexus)上运行,而不能在Sony Xperia LT30p上运行。 I have looked around and have only found this thread talking about the same problem. 我环顾四周,只发现线程在谈论相同的问题。 I thought it might be a problem of RAM or overflowing, so I disabled all background processes and uninstalled most apps. 我认为这可能是RAM或溢出问题,因此我禁用了所有后台进程并卸载了大多数应用程序。 Still, the error persists. 但是,错误仍然存​​在。 Does anyone know why this happens and if there exists a way around it? 有谁知道为什么会这样,是否有解决的办法?

Maybe because the config call order is wrong.. 可能是因为配置调用顺序错误。

    setEGLConfigChooser(8, 8, 8, 8, 16, 0);
    setEGLContextClientVersion(2);
    getHolder().setFormat(PixelFormat.TRANSLUCENT);

And the right order is: 正确的顺序是:

    setEGLContextClientVersion(2);
    setEGLConfigChooser(8, 8, 8, 8, 16, 0);
    getHolder().setFormat(PixelFormat.TRANSLUCENT);

But even using wrong order, the code is still correct in most of the phones.(I just met this error at a 4.2.1 phone) 但是即使使用了错误的命令,该代码在大多数电话中仍然是正确的。(我刚在4.2.1电话中遇到此错误)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM