I have been reading a lot about openFrameworks and Processing, But still can't make the distinction other than one is in C++ and the other in Java. Can someone tell me which is for what exactly?
问题:
回答1:
You are correct, one is C++ and the other is Java, and those differences apply to these frameworks, so it's up to your preferences/project scope to decide which one is best for you.
With Processing:
- You get a minimal IDE, but can easily use Eclipse or other Java IDEs.
- You get memory management (garbage collection)
- You can publish applets online(via Java Applet or 'slimmed down' javascript ports using Canvas 2D with processingjs or p5js) or desktop applications for Linux/OSX/Windows (via Java Runtime). Note that versions newer than Processing 1.5.1 no longer export applets. That can still be done via command line or using eclipse.
- You can publish to Android and (with 3rd party tools) to iPhone using iProcessing or the faster P5Nitro and more recently on Raspberry PI
- You get almost 200 Libraries to extend its functionality.
- You have support from the forums, quite a few books and online 'playgrounds' like OpenProcessing, SketchPatch, hascanvas or SketchPad.
With OpenFrameworks:
- You choose your IDE (XCode on OSX, Code::Blocks, VC++)
- You can manage your own memory (malloc, pointers and all that joy), but with modern C++ it's not necessary.
- You can publish your project as a native application (no runtime needed)
You can not currently easily publish online, but this might change in the future(see Arturo Castro's of-emscripten progress)You can publish online using emscripten.- You can publish to the iPhone, as of OF 007 to Android and OF 0.8.0 to armv6 and armv7 devices such as Raspberry PI or Pandaboard
- You get over 2000 Addons (not all are maintained) to extend its functionality.
- You have support from the very active and helpful forums and can read about it in this online book or on a paper book or two.
These are some of the things the came to mind right now, there could be more.
Personally, I found it easier to write really basic throw-away prototypes in Processing. For situations where speed isn't a major decision factor, Processing does just well, but in other cases, I'd port the Processing prototypes to openFrameworks (which is easy to do most of the time).
An example would be application involving audio, be it analysis or synthesis. Depending on the complexity, the Java Garbage Collector would do a sweep when you least expect it and cause annoyances when you need responsiveness.
In short, both are really cool, but openFrameworks is faster. You pay for that speed by managing memory yourself though.
In terms of deploying online, it really depends on the project: if it's a simple project, probably p5.js might be easiest in terms of integration with other js libraries. The oF export is handy for big bulky complex code that would take too long to manually port to JavaScript, but bare in mind the Emscripten project will be large (e.g. 17.5MB for opencvExample
) (and thus not cellular friendly) and you will still need to add your own JS -> C++ bindings if your need to call oF app function from the webpage.
Also, if you're interested in C++, you might want to also have a look at libcinder or Polycode.
HTH