Hi,
Your vrpn callback must be a function. You are trying to pass a class method instead, which won't work. Try the following instead:
(Tracker.h)
Code:
#include <vrpn_Tracker.h>
class Tracker{
public:
Tracker(char* address);
~Tracker();
vrpn_float64 lastPosition[3];
protected:
vrpn_Tracker_Remote* tracker;
};
(Tracker.cpp)
Code:
#include <string.h>
#include <vrpn_Tracker.h>
#include "Tracker.h"
void handlePos(void *userdata, vrpn_TRACKERCB t)
{
Tracker *tracker = (Tracker*)userdata;
tracker->lastPosition[0] = t.pos[0];
tracker->lastPosition[1] = t.pos[1];
tracker->lastPosition[2] = t.pos[2];
}
Tracker::Tracker(char* address)
{
tracker = new vrpn_Tracker_Remote(address);
//Setup callback for when new position data comes in
tracker->register_change_handler((void*)this, handlePos);
}
Tracker::~Tracker()
{
delete tracker;
}