I am developing a program for a performance artist who needs a backdrop that is running various programs via openFrameworks. He needs a way to be able to easily switch between them somehow. Is there some way of creating a master shell which loads or unloads other openframeworks files?
Share
If you have a way to terminate RunApp() from the clientside (via a quit button), you can wrap the call in a scripting language via tcl or python. You’ll end up with an interactive shell where you can run different apps and set parameters.
For sake of simplicity i’ll leave out some details and assume we do the language binding with boost::python. A more detailed read about this is in this article, the boost::python documentation is here.
The main idea is to create a domain specific language/set of wrappers for OF, which can be used to create OF objects and access their methods either interactively via a shell or through a script.
Boost object bindings work roughly like this (quote from 1):
First define the class in C++
Then, expose it as a python-module
Which looks like this in use in an interactive python session:
Now since one can wrap any class or method there are many possibilities on how to actually tap into OF. The one i was referring to in this answer would be to have f.e. two Apps,
App1,App2implemented in C++/OF, then link to that implementation in python.The interactive session would look something like this:
I’m not an OF hacker but another (easier) possibility might be to interactively change the content of f.e.
ofApp::draw()in an App (running in a thread). This could be done by embedding a custom object parametrizable from within the python interpreter:Which once the OF app runs, could be used to change color interactively from within your interpreter: