jMonkeyVR icon indicating copy to clipboard operation
jMonkeyVR copied to clipboard

LwjglDisplay cannot be cast to LwjglWindow

Open ThomasSchemmer opened this issue 8 years ago • 4 comments

Hi Phr00t,

thanks for your library. I'm currently trying to port OpenDS to accept a Vive and therefore mashing your library in between. As a starter i tried to reenact your basic example, but when i run it i get the following error message:

Jun 30, 2017 11:41:17 AM jmevr.app.VRApplication handleError SCHWERWIEGEND: Uncaught exception thrown in Thread[jME3 Main,5,main] java.lang.ClassCastException: com.jme3.system.lwjgl.LwjglDisplay cannot be cast to com.jme3.system.lwjgl.LwjglWindow at jmevr.util.VRMouseManager.update(VRMouseManager.java:153) at jmevr.util.VRViewManager.update(VRViewManager.java:425) at jmevr.util.VRViewManager.initialize(VRViewManager.java:277) at jmevr.app.VRApplication.initialize(VRApplication.java:1091) at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:130) at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:211) at java.lang.Thread.run(Unknown Source)

I think i included every library that i needed, as i get the following log before the message pops up:

Initializing OpenVR... OpenVR initialized & VR connected. Jun 30, 2017 11:44:17 AM com.jme3.system.JmeDesktopSystem initialize INFORMATION: Running on jMonkeyEngine 3.2-6153

  • Branch: master
  • Git Hash: 8eab825
  • Build Date: 2016-07-20 OpenVR Compositor initialized OK!

What am I missing? Would appreciate any input. Thanks Thomas

ThomasSchemmer avatar Jun 30 '17 09:06 ThomasSchemmer

Update I searched a bit around in the libraries and apparently there are two versions of LwjglDisplay: Lwjgl version 3 and Lwjgl version 1 and it fails because my program is loading the lwjgl version 1, which does not inherit LwjglWindow (hence the cast error). But I cant figure out which of my jars actually references/loads the version 1, as I do not include jme3-lwgl.jar.

ThomasSchemmer avatar Jul 06 '17 12:07 ThomasSchemmer

I do not maintain this library anymore & I've since forgotten too many of the internals to really help here. My only thought is setup a debugger with a breakpoint on construction of the Lwjgl Version 1 LwjglDisplay & see where it gets reached from.

phr00t avatar Jul 06 '17 12:07 phr00t

Eclipse gives me the output:

[Loaded com.jme3.system.lwjgl.LwjglWindow from file:/C:/Users/Comm%20Administrator/Documents/jmonkeyengine-master/dist/lib/jme3-lwjgl3.jar]

so at this point I think im going to give up as I dont want to rebuild the library. Thanks for the feedback though, I can understand that you cant help if you discontinue it.

ThomasSchemmer avatar Jul 06 '17 13:07 ThomasSchemmer

I know that this post is old, but if anyone else is having this problem remove the lwjgl.jar file that came with the sdk (either JMonkey or Phr00t's JMonkey), not the one that came with the Phroot VR.

laterdated avatar Nov 10 '19 00:11 laterdated