oFxOpenni,ofxdepthgenerator, EXC_BAD_ACCESS


i do my first step with openni, and i try to do my first program.
But i got a problem,
when i try to update my depthRecorder, i got an error : EXC_BAD_ACCESS. My program freezes, and when i click on continue i got the same error.

I compare it to the example , but i can’t found what is wrong :confused:
So if you see why i got this error, thanks to help me
I use MB white, with xcode 3 and of 007
This is my code.

#include "ofMain.h"  
#include "testApp.h"  
#include "ofAppGlutWindow.h"  
int main( ){  
    ofAppGlutWindow window;  
	ofSetupOpenGL(&window, 1280,600, OF_WINDOW);			// <-------- setup the GL context  
	// this kicks off the running of my app  
	// pass in width and height too:  
	ofRunApp( new testApp());  
#ifndef _TEST_APP  
#define _TEST_APP  
#include "ofMain.h"  
#include "ofxOpenNI.h"  
class testApp : public ofBaseApp{  
		void setup();  
		void update();  
		void draw();  
		void keyPressed  (int key);  
		void keyReleased(int key);  
		void mouseMoved(int x, int y );  
		void mouseDragged(int x, int y, int button);  
		void mousePressed(int x, int y, int button);  
		void mouseReleased(int x, int y, int button);  
		void windowResized(int w, int h);  
		void dragEvent(ofDragInfo dragInfo);  
		void gotMessage(ofMessage msg);  
	ofxHardwareDriver hardware;  
	ofxOpenNIContext	recordContext;  
	ofxDepthGenerator	recordDepth;  
	ofImage depthRangeMask;  
	int					nearThreshold, farThreshold;  
	bool isLive;  
// testApp.cpp  
#include "testApp.h"  
void testApp::setup(){  
	ofBackground(0, 0, 0, 0);  
	ofSetWindowTitle("mon Application Kinect");  
	ofSetColor(255, 255, 255);  
	// partie concernant le kinect  
void testApp::update(){  
void testApp::draw(){  
	ofSetColor(255, 255, 0);  
	ofDrawBitmapString("yo", 10,10);  
	ofDrawBitmapString("angle kinect : "+ofToString(hardware.tilt_angle), 10,500);  
void testApp::keyPressed(int key){  

any output to the console?

I got this in the console, i pressed once on continue :

The Debugger has exited with status 0.  
[Session started at 2012-05-22 07:49:56 +0200.]  
GNU gdb 6.3.50-20050815 (Apple version gdb-1515) (Sat Jan 15 08:33:48 UTC 2011)  
Copyright 2004 Free Software Foundation, Inc.  
GDB is free software, covered by the GNU General Public License, and you are  
welcome to change it and/or distribute copies of it under certain conditions.  
Type "show copying" to see the conditions.  
There is absolutely no warranty for GDB.  Type "show warranty" for details.  
This GDB was configured as "x86_64-apple-darwin".  
tty /dev/ttys001  
Loading program into debugger
Program loaded.  
[Switching to process 776]  
Init lib_usb control of Kinect Motor, LEDs and accelerometersDevice: 0 Vendor: 1452 Product: 32773  
Device: 1 Vendor: 1133 Product: 49250  
Device: 2 Vendor: 1452 Product: 567  
Device: 3 Vendor: 1452 Product: 32774  
Device: 4 Vendor: 1452 Product: 34055  
Device: 5 Vendor: 1452 Product: 32773  
Device: 6 Vendor: 1452 Product: 32774  
Device: 7 Vendor: 1033 Product: 90  
Device: 8 Vendor: 1118 Product: 688  
Openning device aux 8 on 0  
ofxOpenNIContext.setup() succeed: OK  
AddLicense status: OK  
VENDOR              KEY                   
======              ===                   
    12936 INFO       New log started on 2012-05-22 07:49:58  
    12951 INFO       OpenNI version is 1.5.2 (Build 7)-MacOSX (Dec 30 2011 14:54:24)  
    12962 INFO       --- Filter Info --- Minimum Severity: NONE  
Set console output status: OK  
    12980 INFO       --- Filter Info --- Minimum Severity: ERROR  
Set log level status: OK  
Retrieving depth generator failed: No match found  
Creating depth generator failed: Can't create any node of the requested type!  
Retrieving depth generator failed: No match found  
Retrieving image generator failed: No match found  
No Image generator found: cannot register viewportSet mirroring succeed: OK  
Program received signal:  “EXC_BAD_ACCESS”.  
sharedlibrary apply-load-rules all  
(gdb) continue  
Program received signal:  “EXC_BAD_ACCESS”.  

Ok - it doesn’t understand your camera. I would try re-downloading ofxOpenNI and following the README exactly to make sure you are not missing anything (it is kind of a long process).

You are using a Kinect for Xbox correct? (As opposed to a Kinect for Windows)

So, i did exactly what the readme saids :

Mac OS X:

You don’t need to do any install of drivers if you don’t want, just:

  • Do the git magic above or somehow else get a copy of ofxOpenNI into your addons directory
  • Make a new project (in 062 by copying emptyExample folder from the apps/examples/ directory into your working path -> something like ofFolder/apps/dev/)
  • Copy the folder called ‘lib’ from ‘ofxOpenNI/mac/copy_to_data_openni_path’ to your ‘bin/data/openni’ directory of your emptyExample
  • In Xcode make a new Group called ‘ofxOpenNI’ under ‘Addons’ (right or control click the ‘Addons’ Group, select Add->New Group)
  • Drag the ‘src’ and ‘include’ folders from inside the ofxOpenNI folder (in your addons directory) into the Group ‘ofxOpenNI’ you just made.
  • Drag the folder ‘lib’ from bin/data/openni (the one you just copied) into the Group ‘ofxOpenNI’
  • Add #include “ofxOpenNI.h” at the top of your testApp.h (or in whatever class you’re using ofxOpenNI)

and that don’t work yet, so i take a deep and long look, for compare my project to example project, and found i got a config path in data->openni in example path, which is not in my own path. So i copied this config path from example to my project, and that WORKS
I don’t know if i’m the only one to have this problem, but maybe add this to the readme.

Awesome! Thank you cgiles, I had exactly the same problem, thanks for posting this here!
Also on OS X I needed to execute the change\_exec\_paths.sh shell script before, to make the libs find themselfes :slight_smile:
I had to adapt the cd path at the beginning of the script though

Have you placed correctly the example folder, it must be in /ofFolder/Apps/yourApps/examplefolder/example file.
I got the same error when i began oF