Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglCanvas.java
Original file line number Diff line number Diff line change
Expand Up @@ -645,11 +645,18 @@ protected void runLoop() {
getPrintContextInitInfo(canvas.getGLDataEffective())));
}

try {
if (signalTerminate.tryAcquire(10, TimeUnit.MILLISECONDS)) {
canvas.doDisposeCanvas();
}
} catch (InterruptedException ignored) { }
// On platforms other than Windows, an ideal amount of time is needed
// for the CPU to breathe and avoid interrupting the AWT and OpenGL
// context. This ensures a smooth experience between AWT and OpenGL.
Platform platform = Platform.get();
if (platform != Platform.WINDOWS) {
try {
// Ideal time: 5 milliseconds
if (signalTerminate.tryAcquire(5, TimeUnit.MILLISECONDS)) {
canvas.doDisposeCanvas();
}
} catch (InterruptedException ignored) { }
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
* @author wil
*/
public final class LwjglxDefaultGLPlatform {

/**
* Returns a drawing platform based on the platform it is running on.
* @return LwjglxGLPlatform
Expand All @@ -58,9 +58,9 @@ public static LwjglxGLPlatform createLwjglxGLPlatform() throws UnsupportedOperat
throw new UnsupportedOperationException("Platform " + Platform.get() + " not yet supported");
}
}

/**
* private constructor.
*/
private LwjglxDefaultGLPlatform() {}
}
}