Where/when is it ok to call setFullscreen()?
Posted by
Marian Schedenig on
Aug 18, 2014; 11:18pm
URL: https://forum.jogamp.org/Where-when-is-it-ok-to-call-setFullscreen-tp4032828.html
I allow users to toggle my game's fullscreen mode from an ingame menu. When the fullscreen button is clicked, I call:
glWindow.setUndecorated(fullscreen);
glWindow.setFullscreen(fullscreen);
(fullscreen being a boolean variable, of course)
Sometimes this works fine, but often it triggers a lock exception (see below) and apparently locks up the animator (I use an FPSAnimator). Resize events still update my window, but the animator doesn't.
I do all my own logic from my GLEventListener's display() method. I tried disabling the animator before calling setFullscreen() and reenabling it afterwards, but it didn't help, probably since setFullscreen() internally calls runOnEDTIfAvail() anyway.
This is all on Linux/X11/KDE by the way, I haven't yet tested it on other platforms.
Perhaps I'm simply calling setFullscreen() from the wrong location. But in that case, where/when *is* the correct time to call it?
Exception in thread "main-Display-.x11_:0-1-EDT-1-FPSAWTAnimator-Timer0" com.jogamp.opengl.util.AnimatorBase$UncaughtAnimatorException: javax.media.opengl.GLException: Caught RuntimeException: Waited 5000ms for: <7d0e0c8b, 2559b9d1>[count 1, qsz 0, owner <main-Display-.x11_:0-1-EDT-1>] - <main-Display-.x11_:0-1-EDT-1-FPSAWTAnimator-Timer0> on thread main-Display-.x11_:0-1-EDT-1-FPSAWTAnimator-Timer0
at com.jogamp.opengl.util.AWTAnimatorImpl.display(AWTAnimatorImpl.java:84)
at com.jogamp.opengl.util.AnimatorBase.display(AnimatorBase.java:446)
at com.jogamp.opengl.util.FPSAnimator$MainTask.run(FPSAnimator.java:175)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
Caused by: javax.media.opengl.GLException: Caught RuntimeException: Waited 5000ms for: <7d0e0c8b, 2559b9d1>[count 1, qsz 0, owner <main-Display-.x11_:0-1-EDT-1>] - <main-Display-.x11_:0-1-EDT-1-FPSAWTAnimator-Timer0> on thread main-Display-.x11_:0-1-EDT-1-FPSAWTAnimator-Timer0
at javax.media.opengl.GLException.newGLException(GLException.java:75)
at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1318)
at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:1138)
at com.jogamp.newt.opengl.GLWindow.display(GLWindow.java:666)
at com.jogamp.opengl.util.AWTAnimatorImpl.display(AWTAnimatorImpl.java:77)
... 4 more
Caused by: java.lang.RuntimeException: Waited 5000ms for: <7d0e0c8b, 2559b9d1>[count 1, qsz 0, owner <main-Display-.x11_:0-1-EDT-1>] - <main-Display-.x11_:0-1-EDT-1-FPSAWTAnimator-Timer0>
at jogamp.common.util.locks.RecursiveLockImpl01Unfairish.lock(RecursiveLockImpl01Unfairish.java:198)
at jogamp.nativewindow.ResourceToolkitLock.lock(ResourceToolkitLock.java:56)
at javax.media.nativewindow.DefaultGraphicsDevice.lock(DefaultGraphicsDevice.java:126)
at jogamp.newt.driver.x11.DisplayDriver.dispatchMessagesNative(DisplayDriver.java:109)
at jogamp.newt.WindowImpl$FullScreenAction.run(WindowImpl.java:2347)
at jogamp.newt.WindowImpl.runOnEDTIfAvail(WindowImpl.java:2123)
at jogamp.newt.WindowImpl.setFullscreenImpl(WindowImpl.java:2457)
at jogamp.newt.WindowImpl.setFullscreen(WindowImpl.java:2434)
at com.jogamp.newt.opengl.GLWindow.setFullscreen(GLWindow.java:432)