Hello
I made an applet and have some annoying problems loading assets from an URL.
My intention was to create a small sized Java-Applet and load assets if needed.
I tested this on about 10 PCs with different Java-Versions, Browsers, Connections, Servers (also localhost) and different nightly-builds of jme.
Multiple problems occurred:
On 4 of 10 PCs it was impossible to load fonts and cursors (.cur), this was reproducible. The other PCs loaded them without a peep. After putting the same fonts and cursors into the asset-folder inside the .jar it works on the 4 PCs. This wasn’t nice because it increased the applet-size, but ok…
Sometimes, this is not reproducible, the AWTLoader crashes when loading an image, grrrrrrrr. So my idea was to try loading this image again and voila it was successful. But why it crashes sometimes the first time?
During startup I load some images and cache them. Before this I register a Locator via applet.getCodeBase() and then loading an image for example with:
[java]
assetManager.loadTexture(“gui/images/arrow-next2.png”);
//result:
network: Verbindung von https://www.my-page.de/applet/media/gui/images/arrow-next2.png mit Proxy=HTTP @ /XXX.XXX.XXX.XXX:XXXX wird hergestellt
[/java]
This works fine and I assume this pic is loaded and cached. If I need this pic again it shouldn’t be loaded again via URL because it’s in the assetManager already, right?
But…
Later using this image again with assetManager.loadTexture(“gui/images/arrow-next2.png”); it fails, because it tries to load again with AWTLoader… why?
[java]
network: Cacheeintrag nicht gefunden [URL: file:/C:/Users/XX/AppData/Local/Temp/lwjglcache/www.my-page.de/bla/code.signed.jar, Version: null]
network: Cacheeintrag nicht gefunden [URL: file:/C:/Users/XX/AppData/Local/Temp/lwjglcache/www.my-page.de/bla/code.signed.jar, Version: null]
network: Verbindung von https://www.my-page.de/applet/media/gui/images/arrow-next2.png mit Proxy=HTTP @ /XXX.XXX.XXX.XXX:XXXX wird hergestellt
network: Server https://www.my-page.de/applet/media/gui/images/arrow-next2.png sendet Anfrage für set-cookie mit “PHPSESSID=dg6789r95vlu6p87l7mqpcmc96; path=/;Secure;HttpOnly”
Exception in thread “LWJGL Renderer Thread” com.jme3.asset.AssetLoadException: The given image cannot be loaded gui/images/arrow-next2.png (Flipped)
at com.jme3.texture.plugins.AWTLoader.load(AWTLoader.java:202)
at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:288)
at com.jme3.asset.DesktopAssetManager.loadTexture(DesktopAssetManager.java:346)
at com.jme3.niftygui.RenderImageJme.<init>(RenderImageJme.java:55)
at com.jme3.niftygui.RenderDeviceJme.createImage(RenderDeviceJme.java:166)
at de.lessvoid.nifty.render.NiftyImageManager.addImage(NiftyImageManager.java:127)
at de.lessvoid.nifty.render.NiftyImageManager.registerImage(NiftyImageManager.java:28)
at de.lessvoid.nifty.render.NiftyRenderEngineImpl.createImage(NiftyRenderEngineImpl.java:172)
at de.lessvoid.nifty.effects.impl.ChangeImage.loadImage(ChangeImage.java:45)
at de.lessvoid.nifty.effects.impl.ChangeImage.activate(ChangeImage.java:30)
at de.lessvoid.nifty.effects.Effect.internalStart(Effect.java:112)
at de.lessvoid.nifty.effects.Effect.start(Effect.java:104)
at de.lessvoid.nifty.effects.EffectProcessorImpl.startEffect(EffectProcessorImpl.java:320)
at de.lessvoid.nifty.effects.EffectProcessorImpl.processStartHover(EffectProcessorImpl.java:213)
at de.lessvoid.nifty.effects.EffectManager.handleHoverStartAndEnd(EffectManager.java:179)
at de.lessvoid.nifty.elements.Element.mouseEventHover(Element.java:1607)
at de.lessvoid.nifty.elements.Element.mouseEvent(Element.java:1601)
at de.lessvoid.nifty.screen.MouseOverHandler.processMouseEvent(MouseOverHandler.java:105)
at de.lessvoid.nifty.screen.Screen.forwardMouseEventToLayers(Screen.java:369)
at de.lessvoid.nifty.screen.Screen.mouseEvent(Screen.java:339)
at de.lessvoid.nifty.Nifty.forwardMouseEventToScreen(Nifty.java:308)
at de.lessvoid.nifty.Nifty.access$1600(Nifty.java:77)
at de.lessvoid.nifty.Nifty$NiftyInputConsumerImpl.processEvent(Nifty.java:1373)
at de.lessvoid.nifty.Nifty$NiftyInputConsumerImpl.processMouseEvent(Nifty.java:1329)
at com.jme3.niftygui.InputSystemJme.onMouseMotionEventQueued(InputSystemJme.java:222)
at com.jme3.niftygui.InputSystemJme.forwardEvents(InputSystemJme.java:294)
at de.lessvoid.nifty.Nifty.update(Nifty.java:288)
at com.jme3.niftygui.InputSystemJme.endInput(InputSystemJme.java:113)
at com.jme3.input.InputManager.processQueue(InputManager.java:819)
at com.jme3.input.InputManager.update(InputManager.java:883)
at com.jme3.app.Application.update(Application.java:604)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:231)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:151)
at com.jme3.system.lwjgl.LwjglCanvas.runLoop(LwjglCanvas.java:229)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:228)
at java.lang.Thread.run(Unknown Source)
[/java]
Also, this isn’t reproducible again lol, I could cry. After loading all textures, scene, appstates and so on the viewport is black. There was no exception, nothing. If I enable another viewport with wireframe mode the scene is there. Only the first viewport is still black.
Maybe some issues (not cursors/fonts problem) are caused of multithreading? Loading nifty, caching images, viewports, scene and so on are done in a seperate thread (don’t want to block the update loop during startup) and assetManager/AWTLoader has problems with it, don’t know??