diff --git a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglCanvas.java b/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglCanvas.java index 8ed443f337..516bb9d43e 100644 --- a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglCanvas.java +++ b/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglCanvas.java @@ -539,7 +539,7 @@ public void run() { // All this does is call swapBuffers(). // If the canvas is not active, there's no need to waste time // doing that. - if (renderable.get() && canvas.hasContext()) { + if (renderable.get() && canvas.hasContext() && canvas.isValid()) { try { if (allowSwapBuffers && autoFlush) { // calls swap buffers | lock, etc. @@ -632,7 +632,19 @@ public void create(boolean waitFor) { super.create(waitFor); this.contextFlag.set(true); } - + + /**(non-Javadoc) + * @param createdVal boolean + */ + @Override + protected void waitFor(boolean createdVal) { + // AWT together with LWJGLX cannot handle waitFor() in the best way, + // since the context is created on the fly. + if (createdVal) { + LOGGER.log(Level.WARNING, "create(true) is not supported for AWT!"); + } + } + /** * (non-Javadoc) * @see com.jme3.system.lwjgl.LwjglWindow#destroyContext() @@ -704,6 +716,10 @@ protected void createContext(AppSettings settings) { canvas.createContext(); canvas.makeCurrent(); + SwingUtilities.invokeLater(() -> { + canvas.validate(); + }); + // This will activate the "effective data" scrubber. if (settings.getBoolean("GLDataEffectiveDebug")) { LOGGER.log(Level.INFO, "[ DEBUGGER ] :Effective data to initialize the LWJGL3-AWT context\n{0}",