virtual void onKey(int key, int scancode, int action, int mods) {
   if (!CameraControl::instance().onKey(key, scancode, action, mods)) {
     static const float ROOT_2 = sqrt(2.0f);
     static const float INV_ROOT_2 = 1.0f / ROOT_2;
     if (action == GLFW_PRESS) {
       switch (key) {
       case GLFW_KEY_HOME:
         if (0 == perEyeDelay) {
           perEyeDelay = 1;
         } else {
           perEyeDelay <<= 1;
         }
         return;
       case GLFW_KEY_END:
         perEyeDelay >>= 1;
         return;
       case GLFW_KEY_R:
         resetCamera();
         return;
       case GLFW_KEY_P:
         {
           int caps = ovrHmd_GetEnabledCaps(hmd);
           if (caps & ovrHmdCap_LowPersistence) {
             ovrHmd_SetEnabledCaps(hmd, caps & ~ovrHmdCap_LowPersistence);
           } else {
             ovrHmd_SetEnabledCaps(hmd, caps | ovrHmdCap_LowPersistence);
           }
         }
         return;
       }
     }
     RiftGlfwApp::onKey(key, scancode, action, mods);
   }
 }
  void onKey(int key, int scancode, int action, int mods) {
    if (oria::clearHSW(hmd)) {
      return;
    }

    if (CameraControl::instance().onKey(key, scancode, action, mods)) {
      return;
    }

    if (GLFW_PRESS != action) {
      int caps = ovrHmd_GetEnabledCaps(hmd);
      switch (key) {
      case GLFW_KEY_V:
        if (caps & ovrHmdCap_NoVSync) {
          ovrHmd_SetEnabledCaps(hmd, caps & ~ovrHmdCap_NoVSync);
        } else {
          ovrHmd_SetEnabledCaps(hmd, caps | ovrHmdCap_NoVSync);
        }
        return;
      case GLFW_KEY_P:
        if (caps & ovrHmdCap_LowPersistence) {
          ovrHmd_SetEnabledCaps(hmd, caps & ~ovrHmdCap_LowPersistence);
        } else {
          ovrHmd_SetEnabledCaps(hmd, caps | ovrHmdCap_LowPersistence);
        }
        return;
      case GLFW_KEY_R:
        resetPosition();
        return;
      }
    }

    GlfwApp::onKey(key, scancode, action, mods);
  }
		void SetLowPresistenceMode(bool on)
		{
			unsigned caps = ovrHmd_GetEnabledCaps(m_device);
			if (on)
				caps |= ovrHmdCap_LowPersistence;
			else caps &= ~ovrHmdCap_LowPersistence;
			ovrHmd_SetEnabledCaps(m_device,caps);
			StartTrackingCaps = caps;
		}
OvrSdkRenderer::OvrSdkRenderer()
{
	ovr_Initialize();
	hmd = ovrHmd_Create(0);
	if (hmd) {
		ovrHmd_ConfigureTracking(hmd,
			ovrTrackingCap_Orientation | ovrTrackingCap_MagYawCorrection | ovrTrackingCap_Position, // supported
			ovrTrackingCap_Orientation); // required

		// Set low persistence mode
		int hmdCaps = ovrHmd_GetEnabledCaps(hmd);
		ovrHmd_SetEnabledCaps(hmd, hmdCaps | ovrHmdCap_LowPersistence);
	}
}
kvs::UInt32 HeadMountedDisplay::enabledCaps()
{
    kvs::UInt32 caps;
    KVS_OVR_CALL( caps = ovrHmd_GetEnabledCaps( m_handler ) );
    return caps;
}