src/al/al_kinect1.h
void start() {
		HRESULT result = 0;
		DWORD dwImageFrameFlags;
		DWORD initFlags = 0;

		initFlags = 0;
		if (usecolor) initFlags |= NUI_INITIALIZE_FLAG_USES_COLOR;
		/*if (player) {
			initFlags |= NUI_INITIALIZE_FLAG_USES_DEPTH_AND_PLAYER_INDEX;
		}
		else {*/
			initFlags |= NUI_INITIALIZE_FLAG_USES_DEPTH;
		/*		if (skeleton) {
			initFlags |= NUI_INITIALIZE_FLAG_USES_SKELETON;
		}
		if (audio) {
			initFlags |= NUI_INITIALIZE_FLAG_USES_AUDIO;
		}
		if (high_quality_color) {
			initFlags |= NUI_INITIALIZE_FLAG_USES_HIGH_QUALITY_COLOR;
		}*/


		result = device->NuiInitialize(initFlags);

		if (result != S_OK) {
			console_error("failed to initialize sensor");
			goto done;
		}
		/*
		if (skeleton) {
			if (seated) {
				NuiSkeletonTrackingEnable(NULL, NUI_SKELETON_TRACKING_FLAG_ENABLE_SEATED_SUPPORT);
			}
			else {
				NuiSkeletonTrackingEnable(NULL, 0);
			}
		}
		*/
		console_log("Kinect device initialized");

		if (usecolor) {
			dwImageFrameFlags = 0;
			//if (near_mode) dwImageFrameFlags |= NUI_IMAGE_STREAM_FLAG_ENABLE_NEAR_MODE;
			result = device->NuiImageStreamOpen(
				NUI_IMAGE_TYPE_COLOR, //NUI_IMAGE_TYPE eImageType,
				NUI_IMAGE_RESOLUTION_640x480, // NUI_IMAGE_RESOLUTION eResolution,
				dwImageFrameFlags,
				2, //DWORD dwFrameLimit,
				0,
				&colorStreamHandle);
			if (result != S_OK) {
				console_error("failed to open color stream");
				goto done;
			}
			console_log("opened color stream");
		}

		dwImageFrameFlags = 0;
		dwImageFrameFlags |= NUI_IMAGE_STREAM_FLAG_DISTINCT_OVERFLOW_DEPTH_VALUES;
		//if (near_mode) dwImageFrameFlags |= NUI_IMAGE_STREAM_FLAG_ENABLE_NEAR_MODE;
		NUI_IMAGE_TYPE eImageType = NUI_IMAGE_TYPE_DEPTH;
		/*if (player) {
			eImageType = NUI_IMAGE_TYPE_DEPTH_AND_PLAYER_INDEX;
		}*/
		result = device->NuiImageStreamOpen(
			eImageType,
			NUI_IMAGE_RESOLUTION_640x480, // NUI_IMAGE_RESOLUTION eResolution,
			dwImageFrameFlags,
			2, //DWORD dwFrameLimit,
			0,
			&depthStreamHandle);
		if (result != S_OK) {
			console_error("failed to open depth stream");
			goto done;
		}
		console_log("opened depth stream");

		//estimateCalibration();
		return;

	done:
		close();
	}
// must be called from run thread:
must be called from run thread.
must be called from run thread .
void start() {
		HRESULT result = 0;
		DWORD dwImageFrameFlags;
		DWORD initFlags = 0;
		initFlags = 0;
		if (usecolor) initFlags |= NUI_INITIALIZE_FLAG_USES_COLOR;
			initFlags |= NUI_INITIALIZE_FLAG_USES_DEPTH;
		result = device->NuiInitialize(initFlags);
		if (result != S_OK) {
			console_error("failed to initialize sensor");
			goto done;
		}
		console_log("Kinect device initialized");
		if (usecolor) {
			dwImageFrameFlags = 0;
			result = device->NuiImageStreamOpen(
				NUI_IMAGE_TYPE_COLOR, 
				NUI_IMAGE_RESOLUTION_640x480, 
				dwImageFrameFlags,
				2, 
				0,
				&colorStreamHandle);
			if (result != S_OK) {
				console_error("failed to open color stream");
				goto done;
			}
			console_log("opened color stream");
		}
		dwImageFrameFlags = 0;
		dwImageFrameFlags |= NUI_IMAGE_STREAM_FLAG_DISTINCT_OVERFLOW_DEPTH_VALUES;
		NUI_IMAGE_TYPE eImageType = NUI_IMAGE_TYPE_DEPTH;
		result = device->NuiImageStreamOpen(
			eImageType,
			NUI_IMAGE_RESOLUTION_640x480, 
			dwImageFrameFlags,
			2, 
			0,
			&depthStreamHandle);
		if (result != S_OK) {
			console_error("failed to open depth stream");
			goto done;
		}
		console_log("opened depth stream");
		return;
	done:
		close();
	}
void start ( ) { HRESULT result = 0 ; DWORD dwImageFrameFlags ; DWORD initFlags = 0 ; initFlags = 0 ; if ( usecolor ) initFlags |= NUI_INITIALIZE_FLAG_USES_COLOR ; initFlags |= NUI_INITIALIZE_FLAG_USES_DEPTH ; result = device -> NuiInitialize ( initFlags ) ; if ( result != S_OK ) { console_error ( " " ) ; goto done ; } console_log ( " " ) ; if ( usecolor ) { dwImageFrameFlags = 0 ; result = device -> NuiImageStreamOpen ( NUI_IMAGE_TYPE_COLOR , NUI_IMAGE_RESOLUTION_640x480 , dwImageFrameFlags , 2 , 0 , & colorStreamHandle ) ; if ( result != S_OK ) { console_error ( " " ) ; goto done ; } console_log ( " " ) ; } dwImageFrameFlags = 0 ; dwImageFrameFlags |= NUI_IMAGE_STREAM_FLAG_DISTINCT_OVERFLOW_DEPTH_VALUES ; NUI_IMAGE_TYPE eImageType = NUI_IMAGE_TYPE_DEPTH ; result = device -> NuiImageStreamOpen ( eImageType , NUI_IMAGE_RESOLUTION_640x480 , dwImageFrameFlags , 2 , 0 , & depthStreamHandle ) ; if ( result != S_OK ) { console_error ( " " ) ; goto done ; } console_log ( " " ) ; return ; done : close ( ) ; }
must be called from run thread:
must be called from run thread :
/*if (player) {
			initFlags |= NUI_INITIALIZE_FLAG_USES_DEPTH_AND_PLAYER_INDEX;
		}
		else {*/ /*		if (skeleton) {
			initFlags |= NUI_INITIALIZE_FLAG_USES_SKELETON;
		}
		if (audio) {
			initFlags |= NUI_INITIALIZE_FLAG_USES_AUDIO;
		}
		if (high_quality_color) {
			initFlags |= NUI_INITIALIZE_FLAG_USES_HIGH_QUALITY_COLOR;
		}*/ /*
		if (skeleton) {
			if (seated) {
				NuiSkeletonTrackingEnable(NULL, NUI_SKELETON_TRACKING_FLAG_ENABLE_SEATED_SUPPORT);
			}
			else {
				NuiSkeletonTrackingEnable(NULL, 0);
			}
		}
		*/ //if (near_mode) dwImageFrameFlags |= NUI_IMAGE_STREAM_FLAG_ENABLE_NEAR_MODE; //NUI_IMAGE_TYPE eImageType, // NUI_IMAGE_RESOLUTION eResolution, //DWORD dwFrameLimit, //if (near_mode) dwImageFrameFlags |= NUI_IMAGE_STREAM_FLAG_ENABLE_NEAR_MODE; /*if (player) {
			eImageType = NUI_IMAGE_TYPE_DEPTH_AND_PLAYER_INDEX;
		}*/ // NUI_IMAGE_RESOLUTION eResolution, //DWORD dwFrameLimit, //estimateCalibration();