VR920 SDK FOR XNA?
Vuzix Forums
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



VR920 SDK FOR XNA?Expand / Collapse
Author
Message
Posted 11/9/2008 2:58:54 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum 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?

Post #3602
Posted 11/19/2008 12:11:50 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum 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.
Post #3649
Posted 11/25/2008 12:32:02 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 11/25/2008 12:31:45 AM
Posts: 2, Visits: 16
Wow! Exactly what I needed! Thanks!
Post #3661
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: TechSupport, Daddo

PermissionsExpand / Collapse

All times are GMT -5:00, Time now is 12:48am

Powered By InstantForum.NET v4.1.4 © 2009
Execution: 0.031. 13 queries. Compression Enabled.