Home › Forums › Software Development › Get Eye XYZ Position – cannot find the functions for TX_INTERACTIONBEHAVIORTYPE_ › Reply To: Get Eye XYZ Position – cannot find the functions for TX_INTERACTIONBEHAVIORTYPE_
Hi Edward,
I think the problem in your code snippet (“code before”) is that the hBehavior handle isn’t released between the calls to txCreateInteractorBehavior. If you add a txReleaseHandle in between, the code should still work. The EyeX API now validates that the handles are set to TX_EMPTY_HANDLE on input, and since the handle is set to a valid behavior by the first call the validation will fail.
Note that you still have the choice to use the txCreateInteractorBehavior/txSetXyzBehaviorParams form, as you did in your “Code before” sample. You don’t have to use the shorthand form as shown in your “Code after” sample.
Here is a code snippet demonstrating how to add multiple data streams. (Cut and paste into the MinimalGazeDataStreams sample if you want to try it.)
BOOL InitializeGlobalInteractorSnapshot(TX_CONTEXTHANDLE hContext)
{
TX_HANDLE hInteractor = TX_EMPTY_HANDLE;
TX_GAZEPOINTDATAPARAMS params = { TX_GAZEPOINTDATAMODE_LIGHTLYFILTERED };
TX_FIXATIONDATAPARAMS fixationDataParams = { TX_FIXATIONDATAMODE_SENSITIVE };
TX_HANDLE hBehaviorWithoutParameters = TX_EMPTY_HANDLE;
BOOL success;
success = txCreateGlobalInteractorSnapshot(
hContext,
InteractorId,
&g_hGlobalInteractorSnapshot,
&hInteractor) == TX_RESULT_OK;
success &= txCreateGazePointDataBehavior(hInteractor, ¶ms) == TX_RESULT_OK;
// add a second behavior to the same interactor: fixation data
success &= txCreateFixationDataBehavior(hInteractor, &fixationDataParams) == TX_RESULT_OK;
// add a third behavior to the same interactor: eye position data.
// this one is a bit different because it doesn't take any parameters.
// therefore we use the generic txCreateInteractorBehavior function (and remember to release the handle!)
success &= txCreateInteractorBehavior(hInteractor, &hBehaviorWithoutParameters, TX_BEHAVIORTYPE_EYEPOSITIONDATA) == TX_RESULT_OK;
txReleaseObject(&hBehaviorWithoutParameters);
txReleaseObject(&hInteractor);
return success;
}
As for the question regarding eye position coordinates: you are absolutely correct that the coordinate system used has its origin at the center of the screen. But what makes me puzzled is that it has been that way (in the EyeX API, not in the Gaze API!) for as long as I can remember.