| | | Forum Newbie
       
Group: Forum Members Last Login: 11/25/2008 12:31:45 AM Posts: 2, Visits: 16 |
| | Ok. I got the VR920 working nicely in my own 3d programs in VS/C++. Now XNA 3.0 is out and Im finding C# much easier to work in. Is there a plan for an XNA library to add support for the VR920? Im interested mainly in the stereo 3D more than the tracking, but both would be nice. Alternatively - shouldnt I be able to make an unmanaged DLL with the VR920 SDK in C++ and consume it in managed C#/XNA as long as my games are targeted for Windows, not the Xbox? |
| | | | Forum Newbie
       
Group: Forum Members Last Login: Yesterday @ 2:54:41 PM Posts: 1, Visits: 50 |
| I just got my 920 and this is one of the first things I tried. Anyway it is really easy, you can just use p/invoke to call directly into the driver dlls from C#. Here is what I am using for the stereo driver:
public class StereoCalls {
[DllImport("iwrstdrv.dll", EntryPoint = "IWRSTEREO_Open", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr Open();
[DllImport("iwrstdrv.dll", EntryPoint = "IWRSTEREO_Close", CallingConvention = CallingConvention.Cdecl)]
public static extern void Close(IntPtr handle);
[DllImport("iwrstdrv.dll", EntryPoint = "IWRSTEREO_SetStereo", CallingConvention = CallingConvention.Cdecl)]
public static extern bool SetStereo(IntPtr handle,bool on);
[DllImport("iwrstdrv.dll", EntryPoint = "IWRSTEREO_WaitForAck", CallingConvention = CallingConvention.Cdecl)]
public static extern byte WaitForAck(IntPtr handle,bool eye);
[DllImport("iwrstdrv.dll", EntryPoint = "IWRSTEREO_SetLR", CallingConvention = CallingConvention.Cdecl)]
public static extern bool SetLR(IntPtr handle,bool eye);
[DllImport("iwrstdrv.dll", EntryPoint = "IWRSTEREO_SetLREx", CallingConvention = CallingConvention.Cdecl)]
public static extern bool SetLR(IntPtr handle, bool eye, bool wait);
[DllImport("iwrstdrv.dll", EntryPoint = "IWRSTEREO_GetVersion", CallingConvention = CallingConvention.Cdecl)]
public static extern bool GetVersion(IntPtr ptr);
}
All you have to do is call SetLR and WaitForAck in your Game class's Draw() override right after you call base.Draw(). There may be some performance issues with calling the WaitForAck in the draw loop, but if you don't it will get obviously out of sync. If anyone else has tried using XNA/C# with the 920 and has hit any pitfalls or has any advice I would love to hear it. |
| | | | Forum Newbie
       
Group: Forum Members Last Login: 11/25/2008 12:31:45 AM Posts: 2, Visits: 16 |
| | Wow! Exactly what I needed! Thanks! |
| |
|
|