Forum Discussion
2EyeGuy
12 years agoAdventurer
The SDK is too object oriented
Admittedly, I don't have a Rift, and I'm trying to use the SDK blind. But I'm not really liking this SDK's structure, or the structure of the samples. It looks like it was designed to be complicated and hard to follow. Mostly because it's so object oriented.
If a developer wants to read the head-tracker, a simple SDK would have a single global function like this:
bool ReadHeadTracker(double &yaw, double &pitch, double &roll);
(and maybe versions for quaternions or D3D and OpenGL matrices)
which could be called at any time, perhaps even without initialisation.
And the samples currently have initialisation code spread all over the place.
It all seems needlessly complex.
If a developer wants to read the head-tracker, a simple SDK would have a single global function like this:
bool ReadHeadTracker(double &yaw, double &pitch, double &roll);
(and maybe versions for quaternions or D3D and OpenGL matrices)
which could be called at any time, perhaps even without initialisation.
And the samples currently have initialisation code spread all over the place.
It all seems needlessly complex.
27 Replies
- geekmasterProtege
"atavener" wrote:
Let me know when you have something ready, so I can read Rift head tracker data on my Raspberry Pi! :D
... Now back to libusb and sensor data... - nsbHonored GuestFYI - I posted a first stab at a Linux C library in This thread
- ScawenHeroic Explorer
"densohax" wrote:
I don't think it's a bad SDK personally, but when I had to port Quake3 to use the SDK (Quake3 is in pure C) I couldn't link statically to the SDK, so I had to create an intermediate DLL between them.. Real easy, 4 functions and it will do the job..
Honestly, I don't have my rift, so I couldn't test it yet, but it looks like this.. Good or not, I'll let you be the judge!
libovrwrapper.h
[...]
struct OVR_HMDInfo
{
unsigned HResolution;
unsigned VResolution;
float HScreenSize;
float VScreenSize;
float VScreenCenter;
float EyeToScreenDistance;
float LensSeparationDistance;
float InterpupillaryDistance;
float DistortionK[4];
int DesktopX;
int DesktopY;
char DisplayDeviceName[32];
};
LIBOVRWRAPPER_API int OVR_Init();
LIBOVRWRAPPER_API void OVR_Exit();
LIBOVRWRAPPER_API int OVR_QueryHMD(struct OVR_HMDInfo* refHmdInfo);
LIBOVRWRAPPER_API int OVR_Peek(float* yaw, float* pitch, float* roll);
Hi, I'm the programmer of Live for Speed ( http://www.lfs.net ). I've recently had a go at producing an output suitable for an Oculus Rift and will soon release a test version for our customers to test. We do have several Rift owners who are obviously pleased that I'm trying some support. You can see LFS in a Rift view here :
https://www.lfsforum.net/showthread.php?p=1826678#post1826678
Now the bad news - yesterday I tried to connect with the SDK just to get the above data, hoping to do something like densohax did (quoted above). But I discovered it is impossible to compile the SDK header files in VC6. Yes, LFS comes from the olden days and still uses VC6, because that's all it ever needed. I'm not ready to change compiler at the moment, until some time when we produce an incompatible patch. At the moment all floating point optimisations need to stay the same, so that single player replays and sync checks remain valid. So I can't update to a new compiler. I think the time for that will be when we update to DirectX 9 (the best DirectX still allowing XP compatibility). LFS is still using DirectX 8.1 so I'm guesssing that would be the next problem with the Oculus SDK, even if the compiler could get past the problems with template syntax and the use of functions that were not yet introduced when VC6 was around.
So, the fact remains, I would really love to have an extremely simple SDK that has an interface just like densohax posted, and without any shaders, templates, fancy function calls and so on. This would allow the Rift to be used in projects using DirectX 8.1 and VC6. Otherwise, LFS can't properly support the Rift until some time in the future when we move onto later versions of DirectX and a new compiler. For now our users will have to manually enter their IPD and adjust the screen size and distortion constants if necessary. Also they will have to use some alternative means of head tracking. - jhericoAdventurerI'm working on a build of the community SDK that will include a C API for accessing the Rift. The current interface looks something like this:
void OVR_STDCALL ovrInit();
void OVR_STDCALL ovrDestroy();
unsigned int OVR_STDCALL ovrGetError();
OVR_HANDLE OVR_STDCALL ovrOpenFirstAvailableRift();
void OVR_STDCALL ovrCloseRift(OVR_HANDLE device);
void OVR_STDCALL ovrGetDisplayInfo(OVR_HANDLE device, OvrDisplayInfo * out);
OVR_SENSOR_CALLBACK OVR_STDCALL ovrRegisterSampleHandler(OVR_HANDLE device,
OVR_SENSOR_CALLBACK callback);
void OVR_STDCALL ovrEnableSensorFusion(OVR_HANDLE device,
int enableGravityCorrection,
int enableMagneticCorrection,
int enablePrediction);
void OVR_STDCALL ovrGetPredictedOrientation(OVR_HANDLE device,
float predictionDelta,
OvrQuaternionf * out);
void OVR_STDCALL ovrGetPredictedEulerAngles(OVR_HANDLE device,
float predictionDelta,
OvrVector3f * out);
void OVR_STDCALL ovrGetOrientation(OVR_HANDLE device,
OvrQuaternionf * out);
void OVR_STDCALL ovrGetEulerAngles(OVR_HANDLE device,
OvrVector3f * out); - ScawenHeroic ExplorerThanks for your reply. I also asked technical support about this and was advised that if I need to stick with VC6 and DX8.1 in the main program (for now) I could use a DLL containing the Oculus Rift library compiled in VS2010.
I have done so now, it's basically similar to the one posted by densohax but I have included a few more functions and also used ordinary pointers as I could not get those Ptr things to work. Also the SensorFusion can no longer be declared as a static object but it seems to work fine when allocated using the 'new' keyword (after the system is initialised).
A test patch of Live for Speed is now available with Oculus Rift support in the test patch section of our forum.
https://www.lfsforum.net/forumdisplay.php?f=66
Anyone is welcome to have a go - it works with LFS in demo mode. The Rift support is certainly not finished yet. I have included a list of things that still need to be done in the test patch thread. - jhericoAdventurer
Anyone is welcome to have a go - it works with LFS in demo mode. The Rift support is certainly not finished yet. I have included a list of things that still need to be done in the test patch thread.
Sounds good. Congrats on getting it working. - ceeabdur09Honored GuestDear All, I want to run this program in Microsoft Visual C++ 2013/ win32. I am newer one in this program. please give me a direction to run this program which define this forum. It is very helpful to me if you give me a detail direction. Advance thanks.
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
- 1 year ago
- 3 years ago
- 3 years ago