Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. 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. 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. Still, the error persists. Does anyone know why this happens and if there exists a way around it?

like image 380
Kantharis Avatar asked Jan 22 '26 08:01

Kantharis


1 Answers

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)

like image 189
ChillingVan Avatar answered Jan 23 '26 21:01

ChillingVan