White screen on context restart

I am trying to troubleshoot why when I restart the jme context, the new window just comes up white. But the app is not frozen, key input still works and the window is responsive., the screen is just rendering white. I built a test case, but the test case works correctly.

I have been disabling code within my client trying to figure out why the context restart is not working, but I have not had any luck yet. Does anyone have an idea as to what is going on, or a way to troubleshoot it so I can narrow down what I have broken?



I have had this same issue when I was making an app with jME. It’s really annoying when it comes up because it doesn’t typically tell you what’s wrong in the logs, and from what I know there are many different reasons why it occurs.

One way it happened with me that I can remember from the top of my head, is when I was using the wrong bullet library (i was using the non android library by accident) for my app, but the actual code was completly fine, void of any issues.

Turning on debug mode (using android studio) will show the error in the logs when launching it up, so that might give you a hint on what’s wrong, but from my belief the reason this is caused is that something outside of the code of the game, but rather the android project structure.

1 Like

Hmm. I am not using android, but my test case does not have any physics in it, I am using Minie in my project, and I will add it to my test and see what happens. Thanks!

1 Like

OK, adding Minie to my test project did not cause the issue to occur. Does not look like an issue related to physics.

AH, I figured it out, my test was using LWJGL2 renderer, not 3.

This looks to be an issue with the LWJGL-3 Renderer, see simple test:

package io.tlf.jme.test;

import com.jme3.app.SimpleApplication;
import com.jme3.input.KeyInput;
import com.jme3.input.controls.ActionListener;
import com.jme3.input.controls.KeyTrigger;
import com.jme3.system.AppSettings;

import java.io.IOException;

public class SettingsMain extends SimpleApplication {

    private boolean vsync;

    public void simpleInitApp() {
        vsync = getContext().getSettings().isVSync();

        ActionListener tab = (name, isPressed, tpf) -> {
            if (!isPressed) {
        inputManager.addMapping("tab", new KeyTrigger(KeyInput.KEY_TAB));
        inputManager.addListener(tab, "tab");

    public static void main(String[] args) throws IOException {
        AppSettings settings = new AppSettings(true);
        SettingsMain main = new SettingsMain();

EDIT: Also, on LWJGL-2 although the context comes back, colors are very dark when the new window comes up.


Maybe the gamma correction boolean in appSettings could be getting reset on the restart?

For LWJGL-2:
Before Context Restart:

After Context Restart:

For LWJGL-3:
Before Context Restart:

After Context Restart:

As for gamma on lwjgl-2 after restart, I put System.out.println(getContext().getSettings().isGammaCorrection()); in simpleUpdate and the value did not change after the context restart. I am not too concerned about it though as I mainly use lwjgl3, so I am much more concerned about the context not coming back up for it.

1 Like

Are you getting the standard log output?

Here is the code that actually runs when you try to restart a LWJGL3 context:

Looks like it should be logging a success message, or exception of the code thinks something went wrong…

And the key and mouse input will restart correctly even if the graphics context barfs.

1 Like

May you try with different versions of jme3-lwjgl3 module? (3.2, 3.3, and 3.4 current snapshot)


Tried with a blue box example on different versions of LWJGL3 and for me it shows a black screen after restarting context.

1 Like

Here is the console output: https://gist.github.com/tlf30/b033d54ff50d360187b03f44c341a697

It does log “Display restarted.”
I do not see any errors that stand out.

On my system, I never get the “Click Me!” button at all.

  • Just initializes with a black screen & the statistics sidebar.
  • Has grabbed Mouse/Keyboard input. No cursor feedback.
  • Tab key gives me my mouse back, but I lose the stats

Note about v-sync: I re-wrote the example a bit to try to force v-sync off, and ran into the same thing immediately, and I’ve always had issues trying to turn off v-sync when running the example apps.

I think that my driver does not support a non-v-sync display (Older laptop card w/mesa driver.)

Was your original project (not the minimal example) also playing with the v-sync setting? If so, perhaps this is more of a v-sync status/support issue than a bug in restartContext per. se.

1 Like

Which, (Duh) is of course because that must be part of your original application, rather than the test case. Never Mind.

However, I have found that once I’ve hit tab, the running app pegs one of my CPU cores to 100%, and starts churning through memory. (Before triggering the restart, I’m looking at about 25% of 1 core)

Working on getting some actual thread traces…

1 Like

If you would like I can provide the test case include the javafx component, but it is not necessary to test this issue.

No, I can see that I am moving the flycam, etc. I was just a little disoriented because I didn’t realize that the screenshots were from the original project.

Update on the CPU use: I tried commenting out the call to swap the v-sync mode.

  • Pegged thread is gone
  • Still lose the statistics window

So, maybe I was seeing two different issues?

Can you confirm if this test-case over-uses CPU on your system?

Hmm, I am not seeing the CPU usage increase with the VSync

1 Like

Were you able to get the time to work on tracking down the issue?

Not much.

  • I do believe that the CPU spike happens when v-sync is disabled, due to the render loop running without pause. Not related to this issue.
  • I’ve not been able to collect a heap dump when the render is running correctly for comparison purposes, as the app UI captures my mouse until after I’ve triggered the issue.
1 Like