White screen on context restart

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;

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

        ActionListener tab = (name, isPressed, tpf) -> {
            if (!isPressed) {
                getContext().getSettings().setVSync(!vsync);
                getContext().restart();
            }
        };
        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();
        main.setSettings(settings);
        main.setPauseOnLostFocus(false);
        main.setShowSettings(false);
        settings.setRenderer("LWJGL-OpenGL3");
        main.start();
    }
}

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

4 Likes