Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
philigaultier's avatar
philigaultier
Honored Guest
12 years ago

What can cause ovrHmd_CreateDebug to fail

Hi,

I've written some programs with the Oculus Rift SDK 0.3.2 and everything worked fine.
I ran them with both a 'real' Oculus and the 'false' one, aka created with
ovrHmd_CreateDebug(ovrHmd_DK1)


But here I've come to an unexpected issue: the following code throws the exception:

hmd_ = ovrHmd_Create(0);
if (!hmd_)
{
hmd_ = ovrHmd_CreateDebug(ovrHmd_DK1);

if(!hmd_)
{
throw std::runtime_error("Cannot create the debug dk1");

}
}


The code for ovrHmd_CreateDebug is quite simple (located in CAPI_HmdState.cpp):


OVR_EXPORT ovrHmd ovrHmd_CreateDebug(ovrHmdType type)
{
if (!GlobalState::pInstance)
return 0;

HMDState* hmds = new HMDState(type);
return hmds;
}


So I suppose
GlobalState::pInstance
is null, but how? why?
Until now I did not bother with any GlobalState::pInstance...


Maybe someone knows the cause of the problem or experienced it before?

Thanks for your help

2 Replies

  • You still have to call ovr_Initialize before you call any other functions. If GlobalState::pInstance is null, you have not called it (or you've called ovr_Shutdown at some point).