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

I have seen a few people talk about using the Kinect for Windows SDK with XNA lately, and many of those projects aren't using the SDK how it's intended to be used from a framework such as this.

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



Contact Information:

The Discussion

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to send us feedback you can Contact Us.