forums.naturalpoint.com

Discussion and Support for the OptiTrack, SmartNav and TrackIR brands by NaturalPoint

Callbacks

by avelazquez » Wed Jul 14, 2010 1:42 pm

I am currently working on a project and I want to know how to utilize callbacks. If it makes a difference i am using vc .net. Which makes the MFC example slightly difficult to follow. As I read a previous thread (creating a callback method in C++ ) I noticed someone commenting on the existence of less convoluted examples.

I was polling for frames, but I realized that this is not suitable for what I am doing. Thus I need to know how to initialize callback events on vc .net.

Thanks!
avelazquez
 
Posts: 19
Joined: Mon Jun 07, 2010 7:40 am

by Birch » Wed Jul 14, 2010 2:38 pm

Here is a link to a website which might have some examples of frame callbacks in C++:

I used a C++ callback in a non MFC application. The source code is available at: http://surfacetracker.sourceforge.net. Look at the class OptitrackCamera.


http://surfacetracker.sourceforge.net/

It comes form this thread on our forums:
http://forum.naturalpoint.com/forum/ubb ... 863&page=1
Birch
 
Posts: 1139
Joined: Thu Jan 30, 2003 5:00 am
Location: Corvallis, Oregon

by avelazquez » Fri Jul 16, 2010 10:28 am

Hello as I try to figure out callbacks in the VC .net framework I have hit another dead end. I checked the following link http://surfacetracker.sourceforge.net/ which has some very useful information.

Any further information will be greatly appreciated!

Below is a small section of what I'm trying to do:

/*inside the main function I have the following but it does not work, what I'm attempting to do is declare a pointer to the function FrameAvailable such that when a new frame is available my function FrameAvailableHandle is executed

I know i'm doing something wrong, but I don't know what?

*/



void(*FrameAvailableHandle)(struct INPCamera *pCamera); // where FrameAvailableHandle is the function that will be executed everytime there is a new frame
FrameAvailableHandle=(void *) FrameAvailable(); //where FrameAvailable is the Method
avelazquez
 
Posts: 19
Joined: Mon Jun 07, 2010 7:40 am

by Birch » Fri Jul 16, 2010 4:47 pm

Please check out the "C++ VC8/2005" sample posted to our website. I'd recommend searching the entire project for "FrameAvailable" to see what you may be missing.
Birch
 
Posts: 1139
Joined: Thu Jan 30, 2003 5:00 am
Location: Corvallis, Oregon


Return to OptiTrack SDK

cron