I have two threads running in one sketch and have the problem that the colors interfere and flicker. the background color changes by setFill of a pShape in one thread. I suppose that there is no “clean” solution because color in Proc is not threadsafe and I will have to find a workaround like setting background multiple times during draw()?
UI libraries in general are not thread-safe. Every UI library I know of uses a single thread to draw to the screen, otherwise you get problems like the ones you’re describing.
What are you trying to do with multiple threads drawing to the screen?
Thanks Kevin. I need muiltiple Monitors with different views.
Or is there a possibility to extract a (Full HD) part from a 4K Monitor draw() picture to show only this by beamer and having at the same time the full view on the monitor?
Color is far from the only issue you’ll run into a some point doing this. Lots of things are not threadsafe. A few things in the OpenGL renderers don’t even play nice in the same VM.
What OS? You’re really looking at an OS-specific mirroring option. Or other than that an external splitter, although they’re somewhat expensive - good if you want to drive more than one projector from the same display though.
If I were you, I’d probably consider using Processing as a Java library, which would allow you to have multiple windows displaying and communicating with each other.
Shameless self-promotion: here is a tutorial on using Processing as a Java library:
This unfortunately isn’t by itself a panacea for this, and depending on the renderer (particularly OpenGL) has a tendency to crash. The only safe way is splitting the actual single output or running in separate processes.
Hmm I’ll take your word for it, but I’d still consider it worth trying out.
Thanks. splitting could in this case possibly the simplest solution. And i have some time pressure. Win7 64bit
Thanks vor the Tutorial Link. I would have done this before if i Had a good solution For the communication between max cycling74 and processing via osc. I would appreciate a tutorial forum this topic.
Has anybody a recommendation for splitting on Win7 64bit
a 3840 x 2160 picture to two monitors: one 4K and one FullHD. or
a 1920 x 2160 picture to two FullHD monitors for ?
I mean how to route one section of draw() output to one monitor and another section to another?
And, just to re-confirm, you can’t map your OS to display fullscreen across the two monitors, then run the Processing sketch fullscreen? This is the solution I am used to – that monitor-mapping is an OS-level issue, or that you use a dedicated hardware splitter and plug a single computer graphics out into it.