gameoverhack / ofxOpenNI

Wrapper for OpenNI, NITE and SensorKinect
gingold.com.au
Other
246 stars 121 forks source link

cannot access depthGenerator for dynamically created ofxOpenNI #36

Closed timredfern closed 11 years ago

timredfern commented 11 years ago

I'm running into a weird error- Its happening the same with OSX 10.8 and linux64

I'm trying to create a new ofxOpenNI() from a pointer and delete it. The reason for this is because I need to open a series of .oni files, and it re-opening an ofxOpenNI from a different file doesn't work for me - threading won't work, and it crashes erratically even without threading.

If I make a new ofxOpenNI() from a pointer, it works good, I can keep creating them and threading keeps working. I can display the colour image and the depth image. However if I try to access the depthGenerator I get a crash- getDepthGenerator() seems to return a pointer to 0x00. However if I try to add a depthGenerator it says one exists and "there can only be one".

How it crashes, is that I first

const XnDepthPixel* depthmap=player->getDepthGenerator().GetDepthMap();

and I get a crash at

ofPoint p= player->projectiveToWorld(ofPoint(i,j,(float)(depthmap[j*depthW+i])));

The place the crash occurs at is line 1827 of XnCppWrapper.cpp

inline XNNodeHandle GetHandle() const { return m_hNode; }

*this is pointing at 0x3f8 - would seem to be an unitialised pointer to depthGenerator.

The same technique works fine if I just declare the ofxOpenNI as a class member and let it initialise itself when openframeworks begins.

Any thoughts? I'm baffled.