ofxOpenNI + NITE


I am pretty new to oF and i really love it. Great work guys :slight_smile:

I have an issue (not directly connected with ofxOpenNI, but still related :)).
Because ofxOpenNI does not wrap NITE, such as XnVSwipeDetector i decided to put them to the blender and try it out!

Well, it seems that i can’t even manage to compile the project :-(. I even checked the makefiles provided by NITE (which are the ones priveded by OpenNI) but nothing came out. Of course i modified the config.make in order to link against OpenNI/NITE as well as to find the include directories.

The problem arises when i include <XnVSessionManager.h> o_O which hits to XnVMathCommon.h:

/opt/oF/addons/ofxOpenNI/include/nite/XnVMathCommon.h: At global scope:  
/opt/oF/addons/ofxOpenNI/include/nite/XnVMathCommon.h:86:15: error: expected unqualified-id before numeric constant  
/opt/oF/addons/ofxOpenNI/include/nite/XnVMathCommon.h:87:15: error: expected unqualified-id before numeric constant  

the two lines read:

const XnFloat PI=3.14159265f;  
const XnFloat HALF_PI=(PI/2);  

My other includes are the same found in NITE Boxes example:

#include "ofMain.h"  
#include "ofxOpenNI.h"  
#include <XnOpenNI.h>  
#include <XnCppWrapper.h>  
#include <XnVHandPointContext.h>  
#include <XnVSessionManager.h>  
#include <XnVFlowRouter.h>  
#include <XnVSwipeDetector.h>  
#include <XnVSelectableSlider1D.h>  
#include <XnVSteadyDetector.h>  
#include <XnVBroadcaster.h>  
#include <XnVPushDetector.h>  

Any ideas and suggestions are welcomed.
Thanks in advance, makis.

I think it’s the same issue I banged my head on the first time I tried to integrate OpenNI and OF under linux: PI and HALF_PI are also defined in OF (inside a polite #ifndef :slight_smile: ).

A very raw way to understand if this is your real problem would be to just temporarily comment the declaration and see what happens.

One question: since ofxOpenNI is still under development, what version are you using? GameOverHack’s version (https://github.com/gameoverhack/ofxOpenNI) comes with NITE integration and, so far, did not give me particular problems when working with hands.

Hello, thanks for the reply.
I did just like you said, i commented out these two lines and everyghing works as expected! :slight_smile:

Thanks a lot.