@Override
    public boolean initialize() {
        logger.config("Initializing OpenVR system...");

        hmdErrorStore = new IntByReference();
        vrSystemFunctions = null;

        // Init the native linking to the OpenVR library.
        try{
          JOpenVRLibrary.init();
        } catch(Throwable t){
          logger.log(Level.SEVERE, "Cannot link to OpenVR system library: "+t.getMessage(), t);
          return false;
        }

        JOpenVRLibrary.VR_InitInternal(hmdErrorStore, JOpenVRLibrary.EVRApplicationType.EVRApplicationType_VRApplication_Scene);

        if( hmdErrorStore.getValue() == 0 ) {
            vrSystemFunctions = new VR_IVRSystem_FnTable(JOpenVRLibrary.VR_GetGenericInterface(JOpenVRLibrary.IVRSystem_Version, hmdErrorStore).getPointer());
        }

        if( vrSystemFunctions == null || hmdErrorStore.getValue() != 0 ) {
            logger.severe("OpenVR Initialize Result: " + JOpenVRLibrary.VR_GetVRInitErrorAsEnglishDescription(hmdErrorStore.getValue()).getString(0));
            logger.severe("Initializing OpenVR system [FAILED]");
            return false;
        } else {
            logger.config("OpenVR initialized & VR connected.");

            vrSystemFunctions.setAutoSynch(false);
            vrSystemFunctions.read();

            tlastVsync = new FloatByReference();
            _tframeCount = new LongByReference();

            hmdDisplayFrequency = IntBuffer.allocate(1);
            hmdDisplayFrequency.put(JOpenVRLibrary.ETrackedDeviceProperty.ETrackedDeviceProperty_Prop_DisplayFrequency_Float);
            hmdTrackedDevicePoseReference = new TrackedDevicePose_t.ByReference();
            hmdTrackedDevicePoses = (TrackedDevicePose_t[])hmdTrackedDevicePoseReference.toArray(JOpenVRLibrary.k_unMaxTrackedDeviceCount);
            poseMatrices = new Matrix4f[JOpenVRLibrary.k_unMaxTrackedDeviceCount];
            for(int i=0;i<poseMatrices.length;i++) poseMatrices[i] = new Matrix4f();

            timePerFrame = 1.0 / hmdDisplayFrequency.get(0);

            // disable all this stuff which kills performance
            hmdTrackedDevicePoseReference.setAutoRead(false);
            hmdTrackedDevicePoseReference.setAutoWrite(false);
            hmdTrackedDevicePoseReference.setAutoSynch(false);
            for(int i=0;i<JOpenVRLibrary.k_unMaxTrackedDeviceCount;i++) {
                hmdTrackedDevicePoses[i].setAutoRead(false);
                hmdTrackedDevicePoses[i].setAutoWrite(false);
                hmdTrackedDevicePoses[i].setAutoSynch(false);
            }

            // init controllers for the first time
            vrInput = new OpenVRInput(environment);
            vrInput.init();
            vrInput.updateConnectedControllers();

            // init bounds & chaperone info
            OpenVRBounds bounds = new OpenVRBounds();
            bounds.init(this);
            environment.setVRBounds(bounds);

            logger.config("Initializing OpenVR system [SUCCESS]");
            initSuccess = true;
            return true;
        }
    }
Create a new <a href="https://github.com/ValveSoftware/openvr/wiki/API-Documentation">OpenVR</a> system
attached to the given {@link VREnvironment VR environment}.
@param environment the VR environment to which this API is attached.
jme3-vr/src/main/java/com/jme3/input/vr/openvr/OpenVR.java