void toggleCloseRange(int ) { bool bCloseRange; g_depthStream.getProperty(XN_STREAM_PROPERTY_CLOSE_RANGE, &bCloseRange); bCloseRange = !bCloseRange; g_depthStream.setProperty(XN_STREAM_PROPERTY_CLOSE_RANGE, bCloseRange); displayMessage ("Close range: %s", bCloseRange?"On":"Off"); }
void toggleCloseRange(int ) { static OniBool bCloseRange = FALSE; if (g_depthStream.getProperty(XN_STREAM_PROPERTY_CLOSE_RANGE, &bCloseRange) != XN_STATUS_OK && g_depthStream.getProperty(KINECT_DEPTH_PROPERTY_CLOSE_RANGE, &bCloseRange) != XN_STATUS_OK) { // Continue with the latest value even in case of error } bCloseRange = !bCloseRange; if (g_depthStream.setProperty(XN_STREAM_PROPERTY_CLOSE_RANGE, bCloseRange) != XN_STATUS_OK && g_depthStream.setProperty(KINECT_DEPTH_PROPERTY_CLOSE_RANGE, bCloseRange) != XN_STATUS_OK) { displayError("Couldn't set the close range"); return; } displayMessage ("Close range: %s", bCloseRange?"On":"Off"); }