I try to start SimpleApplication “JMEApp”:
private void attachJmeCanvasToFrame(AppSettings settings) {
JMEApp app = new JMEApp(gameControllerService, settings, props);
app.createCanvas();
app.startCanvas();
// ждём пока JME-окно не прогрузится:
log.info("Ожидание готовности SimpleApplication...");
while (!app.isReady() || app.getAssetManager() == null) {
try {
Thread.sleep(300);
} catch (InterruptedException _) {
}
}
...
and app.createCanvas(); got error “ctx is null”.
Then I do this:
private void attachJmeCanvasToFrame(AppSettings settings) {
JMEApp app = new JMEApp(gameControllerService, settings, props);
// ждём пока JME-окно не прогрузится:
log.info("Ожидание готовности SimpleApplication...");
while (!app.isReady() || app.getAssetManager() == null) {
try {
Thread.sleep(300);
} catch (InterruptedException _) {
}
}
app.createCanvas();
app.startCanvas();
...
and stop into while-cycle forever.
Than, I back all to first variant. And add in my maven pom a library jme3-lwjgl
<!-- jmonkey -->
<dependency> // <<< THIS
<groupId>org.jmonkeyengine</groupId> // <<< THIS
<artifactId>jme3-lwjgl</artifactId> // <<< THIS
<version>3.6.1-stable</version> // <<< THIS
</dependency> // <<< THIS
<dependency>
<groupId>org.jmonkeyengine</groupId>
<artifactId>jme3-core</artifactId>
<version>3.6.1-stable</version>
</dependency>
<dependency>
<groupId>org.jmonkeyengine</groupId>
<artifactId>jme3-lwjgl3</artifactId>
<version>3.6.1-stable</version>
</dependency>
...
And all works! Application starts correctly. I see the game window… but why?
With library jme3-lwjgl I can not to use io.github.jmecn.font.plugins.FtFontLoader.class for loding my fonts (.fnt + .png):
[ERROR] th:jME3 Main c.j.a.LegacyApplication.handleError():666 Uncaught exception thrown in Thread[#68,jME3 Main,6,main]
java.lang.UnsatisfiedLinkError: Failed to locate library: lwjgl.dll
at org.lwjgl.system.Library.loadSystem(Library.java:174)
at org.lwjgl.system.Library.loadSystem(Library.java:64)
at org.lwjgl.system.Library.<clinit>(Library.java:52)
at org.lwjgl.system.MemoryUtil.<clinit>(MemoryUtil.java:100)
at org.lwjgl.system.Pointer$Default.<clinit>(Pointer.java:67)
at io.github.jmecn.font.freetype.FtLibrary.<init>(FtLibrary.java:35)
But without jme3-lwjgl my App is not starts and gamma correction always broken…
(I set settings.setGammaCorrection(true); on application start, as hardcode)
P.S.: isReady() is a boolean, I set it to true in the end of simpleInitApp() of the JMEApp.