A little background on my project. I'm trying to use a Leap Motion controller in combination with a laser program (LaserShow eXpress, or LSX for short). The goal is to create some motion controlled effects, such as drawing 3D shapes in mid-air and projecting them with a laser projector. As there is no way to send signals from the Leap directly to the laser program, OSC seemed like the way to go. To convert the Leap data to OSC signals, I thought Processing might be a suitable tool, to visualize and shape the data before sending it to the laser program. To my surprise, I was able to create a few working sketches quite fast (given my programming experience), and the results turned out really great.
I'm using the LeapMotionP5 library to get data from the Leap and OscP5 to send out OSC signals.
During all this, I encountered one pretty big drawback: when the Processing window is no longer active, no more data is retrieved from the Leap. This is problematic, as my final goal is an application that you can launch so that you can use the laser program in combination with gestures... but as soon as I click in the laser program or somewhere else, the sketch stops functioning!
I tried forcing the window to be always on top (
and asked about it in this topic) but that didn't quite work. The method requestFocus() doesn't work as expected and frame.toFront() works too good: it always makes the window on top making it impossible to work with other programs.
The question is, what now? What causes LeapMotionP5 to stop working when the window isn't active? A quick experiment revealed that OscP5 keeps on sending signals when the window is deselected, so it's really only this library. Does anyone know of a way to force certain code to keep running? Is this just an ordinary bug with the library? What governs the behaviour of the sketch when the window isn't active?
I hope this is just a common problem with an obvious answer I don't know yet, but I fear that's not the case :P
Just wanted to make sure there isn't a simple solution before bugging the library developer.
I recently got my hands on a LeapMotion controller and I'm trying to create an application to send data from the Leap to other programs using OSC signals. To my delight there are a few great libraries available that make this an easy task. However, I encountered one annoying problem: as soon as the window is deactivated (by clicking inside another program), no more information is being retrieved from the Leap. Is there a way to have the application window always on top? I tried all resources I could find, but I'm fairly new to Processing and I'm overwhelmed by all resources available, so I hope the answer isn't somewhere right under my nose...
I found to use the function PApplet.requestFocus() somewhere in
another thread, but this gives the error "Cannot make a static reference to the non-static method requestFocus() from the type Component". No clue what that means...
Maybe having the window on top isn't the right answer at all, but it seems like the easiest solution so far.
I'm using the OscP5 and LeapMotionP5 libraries, if it helps.