if enable VR mode is re-checked then attempt to re-connect to Oculus

This commit is contained in:
Stephen Birarda 2014-08-12 15:20:04 -07:00
parent ac4d20bb43
commit 4bf7bbe0df
4 changed files with 17 additions and 2 deletions

View file

@ -1440,6 +1440,15 @@ void Application::setEnable3DTVMode(bool enable3DTVMode) {
}
void Application::setEnableVRMode(bool enableVRMode) {
if (enableVRMode) {
if (!OculusManager::isConnected()) {
// attempt to reconnect the Oculus manager - it's possible this was a workaround
// for the sixense crash
OculusManager::disconnect();
OculusManager::connect();
}
}
resizeGL(_glWidget->width(), _glWidget->height());
}

View file

@ -135,6 +135,10 @@ void OculusManager::connect() {
} else {
_isConnected = false;
// we're definitely not in "VR mode" so tell the menu that
Menu::getInstance()->getActionForOption(MenuOption::EnableVRMode)->setChecked(false);
ovrHmd_Destroy(_ovrHmd);
ovr_Shutdown();
}

View file

@ -19,6 +19,7 @@
#include "UserActivityLogger.h"
#ifdef HAVE_SIXENSE
const int CALIBRATION_STATE_IDLE = 0;
const int CALIBRATION_STATE_X = 1;
const int CALIBRATION_STATE_Y = 2;
@ -41,8 +42,9 @@ SixenseManager::SixenseManager() {
// By default we assume the _neckBase (in orb frame) is as high above the orb
// as the "torso" is below it.
_neckBase = glm::vec3(NECK_X, -NECK_Y, NECK_Z);
sixenseInit();
#endif
_hydrasConnected = false;
_triggerPressed[0] = false;

View file

@ -71,7 +71,7 @@ private:
glm::vec3 _reachUp;
glm::vec3 _reachForward;
float _lastDistance;
#endif
bool _hydrasConnected;
quint64 _lastMovement;