- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can anyone get the example from the documentation to work.
When I try it the OnNewSample is never called.
pxcmStatus OnNewSample(Int32 mid, PXCMCapture.Sample sample) {
if (sample.color!=null) {
// work on the color sample
...
}
if (sample.depth!=null) {
// work on the depth sample
...
}
// return NO_ERROR to continue, or any error to exit the loop
return pxcmStatus.PXCM_STATUS_NO_ERROR;
};
void CaptureUnalignedColorDepthSamples() {
PXCMSenseManager sm=PXCMSenseManager.CreateInstance();
// select the color and depth streams
sm.EnableStream(PXCMCapture.StreamType.STREAM_TYPE_COLOR,640,480,30);
sm.EnableStream(PXCMCapture.StreamType.STREAM_TYPE_DEPTH,320,240,30);
// Initialize my handler
PXCMSenseManager.Handler handler=new PXCMSenseManager.Handler();
handler.onNewSample=OnNewSample;
sm.Init(handler);
// Streaming
sm.StreamFrames(true);
// Clean up
sm.Dispose();
}
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
To make my question clearer - does the event handler approach work and if so why do none of the samples use it?
They all create a new thread and run the polling loop there which is what the event handler approach is supposed to do for you.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page