I see a lot of people doing calculations in the draw method, which in some cases is necessary (when working on opengl textures etc.), but in most it can be avoided and usually only slows down the drawing thread.
I thought I'd share how I make a separate thread to handle the calculations.
I have a class called CalculationThread which looks like this:
this is probably just a stupid question, but I can't seem to get it right.
When compiling my Processing sketch it adds the data folder to the exported .app or .exe, this works fine when I use methods such as loadStrings, loadImage, loadFont, but when I use new File("data/filename.xml") it doesn't find the file in the compiled version.
Is there a way to use a relative path to the files when using new File?
I've encountered quiet a big problem... Here's the deal. We started working on a project in the Processing IDE a couple of months back, we tried playing movies with audio and everything worked fine. After a while when the project became bigger we emerged to the Eclipse environment and changed to GSVideo 64-bit, BUT, we never tried playing movies with audio until now, 2 weeks before deadline.
When playing a movie with audio the application crashes, I get this dialog window.
And here's the crash report.
Process: java 
Version: 1.0 (1.0)
Code Type: X86-64 (Native)
Parent Process: eclipse 
Date/Time: 2011-09-20 13:40:19.494 +0200
OS Version: Mac OS X 10.7.1 (11B26)
Report Version: 9
Interval Since Last Report: 496373 sec
Crashes Since Last Report: 11
Per-App Interval Since Last Report: 29842 sec
Per-App Crashes Since Last Report: 7
Anonymous UUID: xxx
Crashed Thread: 34
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000013801e1e
I got a quiet big sketch running in Eclipse with GLGraphics and GSVideo. Everything works fine to run from the Eclipse environment.
But when I compile the sketch by "Export" > "Other" > "Mac OS X application bundle", it doesn't add the jnilib files that comes with jogl and GSVideo to the bundle, it only adds the jar-files.
I have linked libgluegen-rt.jnilib, libjogl_awt.jnilib, libjogl_cg.jnilib and libjogl.jnilib to jogl.jar and gluegen-rt.jar in "Java Build Path" > Libraries > Native library location. And same thing with the jnilib files to GSVideo.
I can get it working by rightclicking the compiled bundle and click "Show Package Contents" and go to Contents > Resources > Java and add the jnilib files, but I want to add them when I Export it from Eclipse.
sorry for the topic, but I couldn't figure out how to ask this in short words.
I have an ArrayList with a bunch of PVectors in it. And whenever a new Blob appears (Blob detection) I want to add this to the ArrayList, but only if the blob doesn't intersect with a radius of 20 pixels with a PVector in that ArrayList.
Can anyone hint me in the right direction with some pseudo code? Would appreciate it greatly!