void Release(void) { if (pRendertargetTexture) { pRendertargetTexture->Release(); pRendertargetTexture = NULL; } for (int eyeNum = 0; eyeNum < 2; ++eyeNum) { MeshVBs[eyeNum] = nullptr; MeshIBs[eyeNum] = nullptr; } if (DistortionShaders) { DistortionShaders->UnsetShader(Shader_Vertex); DistortionShaders->UnsetShader(Shader_Pixel); DistortionShaders = nullptr; } DistortionDecl = nullptr; ovrHmd_Destroy(HMD); Util_ReleaseWindowAndGraphics(pRender); if (pRoomScene) delete pRoomScene; if (pScene) delete pScene; ovr_Shutdown(); }
COculusVR::~COculusVR() { if(m_isReady) return; //release wzDeleteRenderTarget(&m_screenRender); wzDeleteRenderBuffer(&m_screenBuffer); wzDeleteTexture(&m_screenTex); wzDeleteShader(&LensShader); wzDeleteMesh(&MeshBuffer[0]); wzDeleteMesh(&MeshBuffer[1]); ovrHmd_SetEnabledCaps(Hmd, ovrHmdCap_DynamicPrediction); //ovrHmdCap_LowPersistence if (Hmd) { ovrHmd_Destroy(Hmd); Hmd = 0; } ovr_Shutdown(); m_isReady = true; }
CoinRiftWidget::~CoinRiftWidget() { #ifdef USE_SO_OFFSCREEN_RENDERER delete renderer; #endif for (int eye = 0; eye < 2; eye++) { rootScene[eye]->unref(); ovrGLTextureData *texData = reinterpret_cast<ovrGLTextureData*>(&eyeTexture[eye]); if (texData->TexId) { glDeleteTextures(1, &texData->TexId); texData->TexId = 0; } #ifdef USE_FRAMEBUFFER if (frameBufferID[eye] != 0) { // OVR::CAPI::GL::glDeleteFramebuffersExt(1, &frameBufferID[eye]); // TODO frameBufferID[eye] = 0; } if (depthBufferID[eye] != 0) { // OVR::CAPI::GL::glDeleteRenderbuffersExt(1, &depthBufferID[eye]); // TODO depthBufferID[eye] = 0; } #endif } scene = 0; //ovrHmd_StopSensor(hmd); ovrHmd_Destroy(hmd); }
//------------------------------------------------------------------------------------- void Release(void) { if (pRendertargetTexture) pRendertargetTexture->Release(); #if !SDK_RENDER for(int eyeNum = 0; eyeNum < 2; eyeNum++) { MeshVBs[eyeNum].Clear(); MeshIBs[eyeNum].Clear(); } if (Shaders) { Shaders->UnsetShader(Shader_Vertex); Shaders->UnsetShader(Shader_Pixel); Shaders->Release(); } #endif ovrHmd_Destroy(HMD); Util_ReleaseWindowAndGraphics(pRender); if (pRoomScene) delete pRoomScene; // No OVR functions involving memory are allowed after this. ovr_Shutdown(); }
void HeadMountedDisplay::destroy() { if ( m_handler ) { ovrHmd_Destroy( m_handler ); m_handler = 0; } }
void gkOculus::Destory() { HMD = 0; ovrHmd_Destroy(HMD); HMD = 0; // No OVR functions involving memory are allowed after this. ovr_Shutdown(); }
void VR_OVR_Disable() { withinFrame = false; if (hmd) { ovrHmd_Destroy(hmd); } hmd = NULL; }
void OVRSDK06AppSkeleton::exitVR() { for (int i = 0; i < 2; ++i) { ovrHmd_DestroySwapTextureSet(m_Hmd, m_pTexSet[i]); } ovrHmd_Destroy(m_Hmd); ovr_Shutdown(); }
void OVRShutdown() { if ( _OVRGlobals.HMD ) { ovrHmd_ConfigureRendering( _OVRGlobals.HMD, NULL, 0, NULL, NULL ); ovrHmd_Destroy( _OVRGlobals.HMD ); _OVRGlobals.HMD = NULL; } ovr_Shutdown(); }
void OVR::preReset() { if (NULL != m_hmd) { ovrHmd_EndFrame(m_hmd, m_pose, m_texture); ovrHmd_Destroy(m_hmd); m_hmd = NULL; } m_debug = false; }
OVR_SDL2_app::~OVR_SDL2_app() { if (buffer[1]) delete buffer[1]; if (buffer[0]) delete buffer[0]; if (context) SDL_GL_DeleteContext(context); if (window) SDL_DestroyWindow(window); if (hmd) ovrHmd_Destroy(hmd); ovr_Shutdown(); }
virtual int run() { SAY("Initializing SDK"); ovr_Initialize(); int hmdCount = ovrHmd_Detect(); SAY("Found %d connected Rift device(s)", hmdCount); for (int i = 0; i < hmdCount; ++i) { ovrHmd hmd = ovrHmd_Create(i); SAY(hmd->ProductName); ovrHmd_Destroy(hmd); } ovrHmd hmd = ovrHmd_CreateDebug(ovrHmd_DK2); SAY(hmd->ProductName); ovrHmd_Destroy(hmd); ovr_Shutdown(); SAY("Exiting"); return 0; }
void Renderer::cleanupOVR() { if(hmd_) { glDeleteFramebuffers(1, &framebuffer_); glDeleteTextures(1, &renderTex_); glDeleteTextures(1, &depthTex_); ovrHmd_Destroy(hmd_); } ovr_Shutdown(); }
void OculusManager::destroyOculusManager() { glDeleteRenderbuffers(1, &l_DepthBufferId); glDeleteTextures(1, &l_TextureId); glDeleteFramebuffers(1, &l_FBOId); // Clean up Oculus... ovrHmd_Destroy(g_Hmd); ovr_Shutdown(); // Clean up window... glfwDestroyWindow(l_Window); glfwTerminate(); }
void VR_Disable() { int i; if( !vr_initialized ) return; for( i = 0; i < 2; i++ ) { DeleteFBO(eyes[i].fbo); } ovrHmd_DestroyMirrorTexture(hmd, (ovrTexture*)mirror_texture); ovrHmd_Destroy(hmd); ovr_Shutdown(); vr_initialized = false; }
OculusWorldDemoApp::~OculusWorldDemoApp() { CleanupDrawTextFont(); if (Hmd) { ovrHmd_Destroy(Hmd); Hmd = 0; } CollisionModels.ClearAndRelease(); GroundCollisionModels.ClearAndRelease(); ovr_Shutdown(); }
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static void oculus_OculusRiftDK2_dealloc(oculus_OculusRiftDK2 *self) { /* Close oculus session */ if (self->device) ovrHmd_Destroy(self->device); /* If this instance was the last one, which used the initialised LibOVR */ if (!--CONTROLLER_COUNT) { IS_INITIALISED = false; ovr_Shutdown(); } /* Free self as a python object */ Py_TYPE(self)->tp_free((PyObject *)self); }
void OculusInterface::init() { try { ovr_Initialize(); hmd = ovrHmd_Create(0); if(hmd) ovrHmd_GetDesc(hmd, &hmdDesc); else throw 0; } catch(int e) { cout << "Cannot get HMD" << endl; //for now. // initialized = false; // return; //TODO replace content of this exeption catch by creating a virtual debug HMD to run correctly hmd = ovrHmd_CreateDebug(ovrHmd_DK2); ovrHmd_GetDesc(hmd, &hmdDesc); } customReport(); try { if(!ovrHmd_StartSensor(hmd,ovrSensorCap_Orientation |ovrSensorCap_YawCorrection |ovrSensorCap_Position,ovrSensorCap_Orientation)) //minial required throw string("Unable to start sensor! The detected device by OVR is not capable to get sensor state. We cannot do anything with that..."); } catch (string const& e) { cerr << e << endl; ovrHmd_Destroy(hmd); ovr_Shutdown(); abort(); } initialized = true; }
//-------------------------------------------------------------------------------------- // 作成したオブジェクトを破棄する //-------------------------------------------------------------------------------------- void CleanupDevice() { if( g_pTextureOculus ) g_pTextureOculus->Release(); if( g_pRenderTargetViewOculus ) g_pRenderTargetViewOculus->Release(); if( g_pShaderResViewOculus ) g_pShaderResViewOculus->Release(); if( g_pPixelShaderOculus ) g_pPixelShaderOculus->Release(); if( g_pVertexShaderOculus ) g_pVertexShaderOculus->Release(); if (g_pVertexBufferOculus[0]) g_pVertexBufferOculus[0]->Release(); if (g_pVertexBufferOculus[1]) g_pVertexBufferOculus[1]->Release(); if (g_pIndexBufferOculus[0]) g_pIndexBufferOculus[0]->Release(); if (g_pIndexBufferOculus[1]) g_pIndexBufferOculus[1]->Release(); if (g_pDepthStencilOculus) g_pDepthStencilOculus->Release(); if (g_pDepthStencilViewOculus) g_pDepthStencilViewOculus->Release(); if (g_pVertexLayoutOculus) g_pVertexLayoutOculus->Release(); if (g_pConstantBufferOculus) g_pConstantBufferOculus->Release(); if (g_pDepthStencil) g_pDepthStencil->Release(); if (g_pDepthStencilView) g_pDepthStencilView->Release(); if (g_pIndexBuffer) g_pIndexBuffer->Release(); if (g_pTextureRV) g_pTextureRV->Release(); if (g_pSamplerLinear) g_pSamplerLinear->Release(); if( g_pVertexBuffer ) g_pVertexBuffer->Release(); if( g_pVertexLayout ) g_pVertexLayout->Release(); if( g_pVertexShader ) g_pVertexShader->Release(); if( g_pPixelShader ) g_pPixelShader->Release(); if( g_pConstantBuffer ) g_pConstantBuffer->Release(); if( g_pRenderTargetView ) g_pRenderTargetView->Release(); if( g_pSwapChain ) g_pSwapChain->Release(); if( g_pImmediateContext ) g_pImmediateContext->Release(); if( g_pd3dDevice ) g_pd3dDevice->Release(); //Oculus Rift(libovr)用 ovrHmd_Destroy(HMD); ovr_Shutdown(); }
~sensor() { ovrHmd_Destroy(session); }
void OculusInterface::releaseOculus() { ovrHmd_Destroy(m_hmd); // shutdown OVR SDK ovr_Shutdown(); }
void RiftShutdown() { ovrHmd_Destroy(s_hmd); ovr_Shutdown(); }
void Oculus::Cleanup() { ovrHmd_Destroy(head_mounted_display); ovr_Shutdown(); }
bool OVR::postReset(void* _nwh, ovrRenderAPIConfig* _config, bool _debug) { if (_debug) { switch (_config->Header.API) { #if BGFX_CONFIG_RENDERER_DIRECT3D11 case ovrRenderAPI_D3D11: { ovrD3D11ConfigData* data = (ovrD3D11ConfigData*)_config; # if OVR_VERSION > OVR_VERSION_043 m_rtSize = data->Header.BackBufferSize; # else m_rtSize = data->Header.RTSize; # endif // OVR_VERSION > OVR_VERSION_043 } break; #endif // BGFX_CONFIG_RENDERER_DIRECT3D11 #if BGFX_CONFIG_RENDERER_OPENGL case ovrRenderAPI_OpenGL: { ovrGLConfigData* data = (ovrGLConfigData*)_config; # if OVR_VERSION > OVR_VERSION_043 m_rtSize = data->Header.BackBufferSize; # else m_rtSize = data->Header.RTSize; # endif // OVR_VERSION > OVR_VERSION_043 } break; #endif // BGFX_CONFIG_RENDERER_OPENGL case ovrRenderAPI_None: default: BX_CHECK(false, "You should not be here!"); break; } m_debug = true; return false; } if (!m_initialized) { return false; } if (!_debug) { m_hmd = ovrHmd_Create(0); } if (NULL == m_hmd) { m_hmd = ovrHmd_CreateDebug(ovrHmd_DK2); BX_WARN(NULL != m_hmd, "Unable to initialize OVR."); if (NULL == m_hmd) { return false; } } BX_TRACE("HMD: %s, %s, firmware: %d.%d" , m_hmd->ProductName , m_hmd->Manufacturer , m_hmd->FirmwareMajor , m_hmd->FirmwareMinor ); ovrBool result; result = ovrHmd_AttachToWindow(m_hmd, _nwh, NULL, NULL); if (!result) { goto ovrError; } ovrFovPort eyeFov[2] = { m_hmd->DefaultEyeFov[0], m_hmd->DefaultEyeFov[1] }; result = ovrHmd_ConfigureRendering(m_hmd , _config , 0 #if OVR_VERSION < OVR_VERSION_050 | ovrDistortionCap_Chromatic // permanently enabled >= v5.0 #endif | ovrDistortionCap_Vignette | ovrDistortionCap_TimeWarp | ovrDistortionCap_Overdrive | ovrDistortionCap_NoRestore | ovrDistortionCap_HqDistortion , eyeFov , m_erd ); if (!result) { goto ovrError; } ovrHmd_SetEnabledCaps(m_hmd , 0 | ovrHmdCap_LowPersistence | ovrHmdCap_DynamicPrediction ); result = ovrHmd_ConfigureTracking(m_hmd , 0 | ovrTrackingCap_Orientation | ovrTrackingCap_MagYawCorrection | ovrTrackingCap_Position , 0 ); if (!result) { ovrError: BX_TRACE("Failed to initialize OVR."); ovrHmd_Destroy(m_hmd); m_hmd = NULL; return false; } ovrSizei sizeL = ovrHmd_GetFovTextureSize(m_hmd, ovrEye_Left, m_hmd->DefaultEyeFov[0], 1.0f); ovrSizei sizeR = ovrHmd_GetFovTextureSize(m_hmd, ovrEye_Right, m_hmd->DefaultEyeFov[1], 1.0f); m_rtSize.w = sizeL.w + sizeR.w; m_rtSize.h = bx::uint32_max(sizeL.h, sizeR.h); m_warning = true; return true; }
OvrSdkRenderer::~OvrSdkRenderer() { ovrHmd_Destroy(hmd); ovr_Shutdown(); }
OculusDevice::~OculusDevice() { ovrHmd_Destroy(m_hmdDevice); ovr_Shutdown(); }
OcudumpBase::~OcudumpBase() { ovrHmd_Destroy(hmd); ovr_Shutdown(); }
void OcculusCameraComponent::destroy() { ovrHmd_Destroy(hmd); ovr_Shutdown(); }
~OculusDeviceImpl() { ovrHmd_Destroy(m_device); }
int32_t VR_OVR_Enable() { int32_t failure = 0; unsigned int hmdCaps = 0; qboolean isDebug = false; unsigned int device = 0; if (!vr_ovr_enable->value) return 0; if (!libovrInitialized) { libovrInitialized = ovr_Initialize(); if (!libovrInitialized) { Com_Printf("VR_OVR: Fatal error: could not initialize LibOVR!\n"); return 0; } else { Com_Printf("VR_OVR: %s initialized...\n",ovr_GetVersionString()); } } { int numDevices = ovrHmd_Detect(); int i; qboolean found = false; memset(hmdnames,0,sizeof(ovrname_t) * 255); Com_Printf("VR_OVR: Enumerating devices...\n"); Com_Printf("VR_OVR: Found %i devices\n", numDevices); for (i = 0 ; i < numDevices ; i++) { ovrHmd tempHmd = ovrHmd_Create(i); if (tempHmd) { Com_Printf("VR_OVR: Found device #%i '%s' s/n:%s\n",i,tempHmd->ProductName, tempHmd->SerialNumber); sprintf(hmdnames[i].label,"%i: %s",i + 1, tempHmd->ProductName); sprintf(hmdnames[i].serialnumber,"%s",tempHmd->SerialNumber); if (!strncmp(vr_ovr_device->string,tempHmd->SerialNumber,strlen(tempHmd->SerialNumber))) { device = i; found = true; } ovrHmd_Destroy(tempHmd); } } } Com_Printf("VR_OVR: Initializing HMD: "); withinFrame = false; hmd = ovrHmd_Create(device); if (!hmd) { Com_Printf("no HMD detected!\n"); failure = 1; } else { Com_Printf("ok!\n"); } if (failure && vr_ovr_debug->value) { ovrHmdType temp = ovrHmd_None; switch((int) vr_ovr_debug->value) { default: temp = ovrHmd_DK1; break; case 2: temp = ovrHmd_DKHD; break; case 3: temp = ovrHmd_DK2; break; } hmd = ovrHmd_CreateDebug(temp); isDebug = true; Com_Printf("VR_OVR: Creating debug HMD...\n"); } if (!hmd) return 0; if (hmd->HmdCaps & ovrHmdCap_ExtendDesktop) { Com_Printf("...running in extended desktop mode\n"); } else if (!isDebug) { Com_Printf("...running in Direct HMD mode\n"); Com_Printf("...Direct HMD mode is unsupported at this time\n"); VR_OVR_Disable(); VR_OVR_Shutdown(); return 0; } Com_Printf("...device positioned at (%i,%i)\n",hmd->WindowsPos.x,hmd->WindowsPos.y); if (hmd->HmdCaps & ovrHmdCap_Available) Com_Printf("...sensor is available\n"); if (hmd->HmdCaps & ovrHmdCap_LowPersistence) Com_Printf("...supports low persistance\n"); if (hmd->HmdCaps & ovrHmdCap_DynamicPrediction) Com_Printf("...supports dynamic motion prediction\n"); if (hmd->TrackingCaps & ovrTrackingCap_Position) Com_Printf("...supports position tracking\n"); Com_Printf("...has type %s\n", hmd->ProductName); Com_Printf("...has %ux%u native resolution\n", hmd->Resolution.w, hmd->Resolution.h); if (!VR_OVR_InitSensor()) { Com_Printf("VR_OVR: Sensor initialization failed!\n"); } ovrHmd_ResetFrameTiming(hmd,0); return 1; }