Hello Guest

[BUG] OpenGL ES 2 fullscreen -> windowed = Failed EGL error: Bad EGL context

  • 1 Replies
  • 5016 Views
testcase: Run the FullScreenWindowedTest and then press w trigger the bug.

java -cp libs/lwjgles_test.jar:libs/lwjgles.jar:libs/lwjgl_util.jar -Djava.library.path=bin/lwjgles org.lwjgl.test.opengles.FullScreenWindowedTest
Change between fullscreen and windowed mode, by pressing F and W respectively
Move quad using arrowkeys, and change rotation using +/-
org.lwjgl.LWJGLException: Failed to change the current context. EGL error: Bad EGL context
   at org.lwjgl.opengles.EGL.throwEGLError(EGL.java:919)
   at org.lwjgl.opengles.EGL.eglMakeCurrent(EGL.java:677)
   at org.lwjgl.opengles.EGLContext.makeCurrent(EGLContext.java:104)
   at org.lwjgl.opengles.EGLContext.makeCurrent(EGLContext.java:100)
   at org.lwjgl.opengl.ContextGLES.makeCurrent(ContextGLES.java:145)
   at org.lwjgl.opengl.DrawableGLES.makeCurrent(DrawableGLES.java:190)
   at org.lwjgl.opengl.Display.makeCurrent(Display.java:731)
   at org.lwjgl.opengl.Display.makeCurrentAndSetSwapInterval(Display.java:1050)
   at org.lwjgl.opengl.Display.setDisplayModeAndFullscreenInternal(Display.java:538)
   at org.lwjgl.opengl.Display.setDisplayModeAndFullscreen(Display.java:516)
   at org.lwjgl.test.opengles.FullScreenWindowedTest.processKeyboard(FullScreenWindowedTest.java:200)
   at org.lwjgl.test.opengles.FullScreenWindowedTest.mainLoop(FullScreenWindowedTest.java:119)
   at org.lwjgl.test.opengles.FullScreenWindowedTest.execute(FullScreenWindowedTest.java:83)
   at org.lwjgl.test.opengles.FullScreenWindowedTest.main(FullScreenWindowedTest.java:324)
Exception in thread "main" java.lang.IllegalStateException: Keyboard must be created before you can query key state
   at org.lwjgl.input.Keyboard.isKeyDown(Keyboard.java:398)
   at org.lwjgl.test.opengles.FullScreenWindowedTest.processKeyboard(FullScreenWindowedTest.java:209)
   at org.lwjgl.test.opengles.FullScreenWindowedTest.mainLoop(FullScreenWindowedTest.java:119)
   at org.lwjgl.test.opengles.FullScreenWindowedTest.execute(FullScreenWindowedTest.java:83)
   at org.lwjgl.test.opengles.FullScreenWindowedTest.main(FullScreenWindowedTest.java:324)
xranby@trimslice:/media/go_/LWJGL-svn$

*

Offline spasi

  • *****
  • 2106
    • WebHotelier
Switching between fullscreen and windowed mode is one thing that LWJGL doesn't handle properly for EGL. The problem is that LWJGL currently destroys and recreates the window when we switch display modes, which is a no-go for EGL. EGL contexts depend on EGL displays and EGL displays depend on the native window, so if the window is destroyed, everything is destroyed.

I have updated the FullScreenWindowedTest to destroy and recreate the Display on mode change. That means GL objects need to be recreated, which isn't a bad compromise, since users already need to be ready for EGL_CONTEXT_LOST events.

A proper fix for this needs to wait for LWJGL 3.0. We need to implement display mode switching without window destruction. We have window resizing now, so I guess we only need a cross-platform call to update window decorations.