Search in sources :

Example 1 with OSVR_DisplayConfig

use of com.jme3.system.osvr.osvrdisplay.OsvrDisplayLibrary.OSVR_DisplayConfig in project jmonkeyengine by jMonkeyEngine.

the class OSVR method initialize.

@Override
public boolean initialize() {
    logger.config("Initialize OSVR system.");
    hmdPose.setAutoSynch(false);
    context = OsvrClientKitLibrary.osvrClientInit(defaultJString, 0);
    VRinput = new OSVRInput(environment);
    initSuccess = context != null && VRinput.init();
    if (initSuccess) {
        PointerByReference grabDisplay = new PointerByReference();
        byte retval = OsvrDisplayLibrary.osvrClientGetDisplay(context, grabDisplay);
        if (retval != 0) {
            System.out.println("OSVR Get Display Error: " + retval);
            initSuccess = false;
            return false;
        }
        displayConfig = new OSVR_DisplayConfig(grabDisplay.getValue());
        System.out.println("Waiting for the display to fully start up, including receiving initial pose update...");
        int i = 400;
        while (OsvrDisplayLibrary.osvrClientCheckDisplayStartup(displayConfig) != 0) {
            if (i-- < 0) {
                System.out.println("Couldn't get display startup update in time, continuing anyway...");
                break;
            }
            OsvrClientKitLibrary.osvrClientUpdate(context);
            try {
                Thread.sleep(5);
            } catch (Exception e) {
            }
        }
        System.out.println("OK, display startup status is good!");
    }
    return initSuccess;
}
Also used : PointerByReference(com.sun.jna.ptr.PointerByReference) OSVR_DisplayConfig(com.jme3.system.osvr.osvrdisplay.OsvrDisplayLibrary.OSVR_DisplayConfig)

Aggregations

OSVR_DisplayConfig (com.jme3.system.osvr.osvrdisplay.OsvrDisplayLibrary.OSVR_DisplayConfig)1 PointerByReference (com.sun.jna.ptr.PointerByReference)1