Closed hamoid closed 8 years ago
I'll try to describe the issue to myself here.
We have two sketches. Each has its own setup() and draw(). Each can send data to the other. This data should not trigger any direct changes, but should be stored and accessed later from inside draw(). If the data has immediate side effects (drawing stuff on the screen, or modifying data that the draw loop needs) errors occur.
The way to deal with this seems to be: a sketch can receive data from the other sketch, store it, and set a flag that indicates this data has been received. The draw() loop will act on that flag, maybe imitating openFrameworks' update() method: if(newData) { update(); }
.
This enforces that visual side effects are only run from inside draw(), and not in a different thread.
Our main program and control panel run in different threads. This introduces complexities that need to be solved.