// Initializes the freenect context private static void InitializeContext( ) { int result = freenect_init(ref KinectNative.freenectContext, IntPtr.Zero); if (result != 0) { throw new ApplicationException("Could not initialize freenect context. Error Code:" + result); } // set callback for logging KinectNative.freenect_set_log_level(freenectContext, LogLevelOptions.Error); KinectNative.freenect_set_log_callback(freenectContext, logCallback); }
// Initializes the freenect context private static void InitializeContext() { try { int result = freenect_init(ref KinectNative.freenectContext, IntPtr.Zero); if (result != 0) { throw new ApplicationException("Could not initialize freenect context. Error Code:" + result); } // set callback for logging KinectNative.freenect_set_log_level(freenectContext, LogLevelOptions.Error); KinectNative.freenect_set_log_callback(freenectContext, logCallback); } catch (DllNotFoundException ex) { throw new DllNotFoundException("Freenect.dll library could not be found. Please " + "make sure that you also have installed LibUSB for your Kinect device.", ex); } }