Tip for using the Kinect for Windows SDK with XNA
Getting started with in a somewhat different development platform and usage style, XNA...
Kinect for Windows SDK + XNA
When I had a hand in working on the managed SDK, I made a point that the API should allow for both an "eventing" model, and a polling model. In the land of WPF and WinForms, an eventing model makes perfect sense. In these frameworks, the SDK is intended to be used thusly:
But, in the land of XNA, where all of your code is shared between the Update and Draw methods, and where events don't really exist in the normal flow of things, trying to synchronize the Kinect events and the data they provide with the Update and Draw loop can be difficult, and can lead to conditions where data is being updated from an event while you're touching it in the Update method. Sure, you could use locks to help synchronize things, but there's an easier way.
To help with this, the API contains methods to directly poll for the latest data, such as the current depth frame or skeleton frame. These methods can be used as shown:
So, if you're using XNA in tandem with the Kinect for Windows SDK, be sure to use the API as it was intended. It will likely save you some debugging headaches later on.
Project Information URL: http://www.brianpeek.com/post/2011/11/21/Kinect-for-Windows-SDK-XNA.aspx
Runs with Beta2? Yes
This conversation has been locked by the site admins. No new comments can be made.