That is my code, I'm using example setup for clicking emulation
void MyDevice::startEmulation() {
joystickX = 0;
joystickY = 0;
trackpadX = 0;
trackpadY = 0;
std::thread thread_object([](void* device) {
MyDevice* myDevice = (MyDevice*)device;
for (;;) {
myDevice->joystickX = 0.95;
myDevice->joystickY = 0.95;
std::this_thread::sleep_for(std::chrono::seconds(1));
myDevice->joystickX = 0;
myDevice->joystickY = 0;
std::this_thread::sleep_for(std::chrono::seconds(1));
}
; }, this
);
}
That's where is it calling
EVRInitError MyDeviceProvider::Init(IVRDriverContext* pDriverContext)
{
EVRInitError initError = InitServerDriverContext(pDriverContext);
if (initError != EVRInitError::VRInitError_None)
{
return initError;
}
VRDriverLog()->Log("Initializing Finally Functional's VR Shoes");
controllerDriver = new MyDevice();
controllerDriver->startEmulation();
VRServerDriverHost()->TrackedDeviceAdded("teensyDriver", TrackedDeviceClass_Controller, controllerDriver);
return vr::VRInitError_None;
}
Is it good idea to use threading in openVR applications? @chengnay