Forum Discussion
thriplow
11 years agoHonored Guest
You can compile/test a Rift app without a Rift...
In case it helps any new Rift developer (like me), here's a hint of how to develop in Direct Mode *without* always needing the actual headset. This will be obvious to anyone that already knows it, but to a noob it isn't, trust me.
If you're using Direct Mode it is possible to use the Oculus driver 'ovrHmdCap_NoMirrorToWindow' flag to control whether or not the Rift view is mirrored to your desktop. Default is mirroring 'ON', anyway. With a small extra step (particularly useful during early development) you can have your app mirror to the desktop even if you do NOT actually have the Rift connected.
Within your initialization code you test to see whether your ovrHmd variable (here HMD) was successfully initialized with ovrHmd_Create(0), and if NOT then you initialize with ovrHmd_CreateDebug(ovrHmd_DK2) instead. That gives you a dummy debug HMD so the rest of your code works (although you won't get headset position updates). You can keep programming if what you're doing is workable via the view in the distorted desktop window.
I modified the Win32_OculusRoomTiny.cpp with the couple of lines below and bingo, you can compile and run the executable without the headset.
I'm actually trying to get a programming template that gives me a window with a single viewpoint, without the distortion (i.e. render the backbuffer directly to a normal window within the app code) but I didn't realise at least getting the distorted binary view is a simple one-line-mod...
If you're using Direct Mode it is possible to use the Oculus driver 'ovrHmdCap_NoMirrorToWindow' flag to control whether or not the Rift view is mirrored to your desktop. Default is mirroring 'ON', anyway. With a small extra step (particularly useful during early development) you can have your app mirror to the desktop even if you do NOT actually have the Rift connected.
Within your initialization code you test to see whether your ovrHmd variable (here HMD) was successfully initialized with ovrHmd_Create(0), and if NOT then you initialize with ovrHmd_CreateDebug(ovrHmd_DK2) instead. That gives you a dummy debug HMD so the rest of your code works (although you won't get headset position updates). You can keep programming if what you're doing is workable via the view in the distorted desktop window.
I modified the Win32_OculusRoomTiny.cpp with the couple of lines below and bingo, you can compile and run the executable without the headset.
I'm actually trying to get a programming template that gives me a window with a single viewpoint, without the distortion (i.e. render the backbuffer directly to a normal window within the app code) but I didn't realise at least getting the distorted binary view is a simple one-line-mod...
int Init()
{
// Initializes LibOVR, and the Rift
ovr_Initialize();
if (!HMD)
{
HMD = ovrHmd_Create(0);
/************* NEW CODE HERE *************/
if (!HMD)
{
HMD = ovrHmd_CreateDebug(ovrHmd_DK2);
}
/*************** END OF NEW CODE **********/
if (!HMD)
{
MessageBoxA(NULL, "Oculus Rift not detected.?", "", MB_OK);
return(1);
}
4 Replies
- cyberealityGrand ChampionThanks for sharing!
- saimouliExplorerWhat libraries did you use? I'm using VS2012 and it is not taking in the functions like HMD, ovrHmd_Create, and ovrHmd_CreateDebug. Also, I using oculus SDK (latest version (8)).
"saimouli" wrote:
What libraries did you use? I'm using VS2012 and it is not taking in the functions like HMD, ovrHmd_Create, and ovrHmd_CreateDebug. Also, I using oculus SDK (latest version (8)).
Those are all from the old sdks, not 0.8.
For example, ovrHmd_Create is now ovr_Create.
HMD isn't working because you didn't define it. His code was just a snippet from a bigger program that had HMD defined somewhere else (class member or global variable). It would be:ovrSession HMD;
- thewhiteambitAdventurerYou can always set the Oculus Runtime to da Debug-DK2 Device. Compiling should have never been a problem, even without a device attached (at least it should never fail because a device is missing). And if your concern is just to run the programs without Rift, I would go for Debug-Mode and no code changes...
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 6 months ago
- 2 years ago
- 1 year ago