Official VR module


#101

Firstly thank you for you time.

  1. When I run the following main function with out the headset plugged in:

public static void main(String[] args) {

AppSettings settings = new AppSettings(true);

settings.put(VRConstants.SETTING_VRAPI, VRConstants.SETTING_VRAPI_OPENVR_VALUE);

settings.put(VRConstants.SETTING_ENABLE_MIRROR_WINDOW, true);

VREnvironment env = new VREnvironment(settings);

env.initialize();

// Checking if the VR environment is well initialized

// (access to the underlying VR system is effective, VR devices are detected).

if (env.isInitialized()){

VRAppState vrAppState = new VRAppState(settings, env);

vrAppState.setMirrorWindowSize(1024, 800);

Main app = new Main(vrAppState);

app.setLostFocusBehavior(LostFocusBehavior.Disabled);

app.setSettings(settings);

app.setShowSettings(false);

app.start();

}

}

The output is :

run:

May 22, 2019 3:20:44 AM com.jme3.input.vr.openvr.OpenVR initialize

SEVERE: OpenVR Initialize Result: Hmd Not Found (108)

May 22, 2019 3:20:44 AM com.jme3.input.vr.openvr.OpenVR initialize

SEVERE: Initializing OpenVR system [FAILED]

May 22, 2019 3:20:44 AM com.jme3.app.VREnvironment initialize

WARNING: VR native wrapper initialized [FAILED]

May 22, 2019 3:20:44 AM com.jme3.app.VREnvironment initialize

SEVERE: Cannot initialize VR environment [FAILED]

Then I connect ad turn on the head set and run I get the following output:

run:

Exception in thread “main” java.lang.IllegalStateException: Pointer native@0x7ffb02730560 already mapped to Proxy interface to native function@0x7ffb02730560 (com.jme3.system.jopenvr.VR_IVRSystem_FnTable$ComputeDistortion_callback).

Native code may be re-using a default function pointer, in which case you may need to use a common Callback class wherever the function pointer is reused.

at com.sun.jna.CallbackReference.getCallback(CallbackReference.java:148)

at com.sun.jna.CallbackReference.getCallback(CallbackReference.java:131)

at com.sun.jna.Pointer.getValue(Pointer.java:425)

at com.sun.jna.Structure.readField(Structure.java:720)

at com.sun.jna.Structure.read(Structure.java:580)

at com.jme3.input.vr.openvr.OpenVR.initialize(OpenVR.java:202)

at com.jme3.app.VREnvironment.initialize(VREnvironment.java:477)

at mygame.Main.main(Main.java:25)

C:\Users\dbmapit\AppData\Roaming.jmonkeyplatform\v3.2.2-stable-sdk1\var\cache\executor-snippets\run.xml:53: Java returned: 1

BUILD FAILED (total time: 6 seconds)


#102

#103

And if you use this setting?

SETTING_VRAPI_OPENVR_LWJGL_VALUE

The LWJGL implementation uses JNI rather than JNA. (I’m unsure which version it’s available in, or if you use master, so it might be unavailable)


#104

Hello,

Make your tests with settings.put(VRConstants.SETTING_VRAPI, SETTING_VRAPI_OPENVR_LWJGL_VALUE);

In this case you’re avoiding all problems related to JNA, OpenVR version as the VR module will delegate to LWJGL the wrap with the headset.

For more information OPENVR API has to be used with HTC vive headsets and OSVR API has to be used with OCULUS Headsets.


#105

Thank you “seinturier”

I tried settings.put(VRConstants.SETTING_VRAPI, VRConstants.SETTING_VRAPI_OPENVR_LWJGL_VALUE);

and got the following error:

Exception in thread “main” java.lang.IllegalStateException: Pointer native@0x7ffb01360560 already mapped to Proxy interface to native function@0x7ffb01360560 (com.jme3.system.jopenvr.VR_IVRSystem_FnTable$ComputeDistortion_callback).

Native code may be re-using a default function pointer, in which case you may need to use a common Callback class wherever the function pointer is reused.

at com.sun.jna.CallbackReference.getCallback(CallbackReference.java:148)

at com.sun.jna.CallbackReference.getCallback(CallbackReference.java:131)

at com.sun.jna.Pointer.getValue(Pointer.java:425)

at com.sun.jna.Structure.readField(Structure.java:720)

at com.sun.jna.Structure.read(Structure.java:580)

at com.jme3.input.vr.openvr.OpenVR.initialize(OpenVR.java:202)

at com.jme3.app.VREnvironment.initialize(VREnvironment.java:477)

at mygame.Main.main(Main.java:25)

C:\Users\dbmapit\AppData\Roaming.jmonkeyplatform\v3.2.2-stable-sdk1\var\cache\executor-snippets\run.xml:53: Java returned: 1

BUILD FAILED (total time: 1 second)


#106

Try disabling the camera in SteamVR

Edit: It shouldn’t try to initialize OpenVR if VRConstants.SETTING_VRAPI_OPENVR_LWJGL_VALUE is used, rather “OpenVrLwjgl”


Oculus SDK & Quest. VR info in general?
#107

and OSVR API has to be used with OCULUS Headsets.

You should be using OCULUSVR with Oculus headsets?

OSVR is something else entirely.