How to gracefully close/exit/delete/finish/? a SimpleOpenNI context and then create a new context?

65 views
Skip to first unread message

Tracy Collins

unread,
Jan 9, 2014, 3:49:54 PM1/9/14
to simple-ope...@googlegroups.com
I'm trying to write a sketch where I record Kinect data to an .oni file, and then switch modes to playback the just recorded data.

The problem that I'm having seems to be that there's no way to gracefully shutdown the Kinect context between recording and playing back or vice-versa.

I've tried context.close(), context.delete(), context.finish() and just re-instantiating(?) it like: "context = new SimpleOpenNI(this, fileName);"   It seems that the previous context does not release the Kinect, so that the new context returns the error "SimpleOpenNI Error: Can't open device: ..."

Thoughts?

thanks,
t

Tomasz Osiecki

unread,
Apr 16, 2016, 4:04:21 PM4/16/16
to simple-openni-discuss
I have the same problem. Is way to close SimpleOpenNI context and intialize it again in another PApplet, but in the same application?

My programs starts and I have to options to pick from: record or play. Both of them are PApplets. This one which I choose as first always run without problem, but when I try to pick another(after disposing first JFrame and destroy PApplet) I have error:

Exception in thread "Animation Thread" java.lang.NullPointerException
at menu_processing.RecordSketchKinect.setup(RecordSketchKinect.java:52)
at processing.core.PApplet.handleDraw(PApplet.java:2361)
at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:240)
at processing.core.PApplet.run(PApplet.java:2256)
at java.lang.Thread.run(Unknown Source)


Anyone can help?

Thanks in advance
Reply all
Reply to author
Forward
0 new messages