Help building a distributed canvas

Hello processing forum. I have questions to ask because i’m new to processing and i’m still confused.
I will write my questions below.

I want to make a distributed scetch which is shown on one machine while other machine(s) send the desired scetch back to the first machine.
I guess i’m using the net library and i create a server and a client.

1)Which method am i supposed to use to send back to the server the whole scetch i have created on the client ?

  1. Is it possible to assign a client to send a portion on the created scetch back to the server ? How can i accomplish that ?

Thanks for reading and im waiting for a response from more experienced Processing users than me.

This is a pretty big question, and it’s going to be hard to give you one specific answer.

Like many things in programming, there isn’t just one way to do this. How you approach it really depends on you and your context more than anything.

But speaking generally, I would try to break your problem down into smaller steps and take those steps on one at a time. can you get a simple client-server working where you send a hard-coded message between them? The Network library might be helpful.

After you have that working, then you can think about how you’d send more complicated data. Good luck!

4 Likes

So to understand your question, do you want to share what one person sees in the screen, or a portion of it, in another machine through a network? Or are you looking for an interactive experience between the machines?

Kf

I will discribe it as silmple as i can.

Im using multiple raspberry pis which are plugged in to the network.

First step: I want my entire canvas created on one raspberry to show up on another raspberry.

Second step: I want each raspberry to send a portion of the canvas, to the “master” raspberry (aka server) , so the whole canvas is depicted there.

Thanks for your interest and i hope i did not confuse you more.

For transfering images between your Pi units, use the following reference: https://shiffman.net/processing.org/udp/2010/11/13/streaming-video-with-udp-in-processing/ This reference is good for transferring a whole image or portions of images.

For the second part, getting the image from your sketch: Use PImage.get() to get the current image in your sketch. Then you can use the above to send it to other(s) R-pi’s. To get a portion of the image, you can use the same get() image but using the 4 parameter function.You can find about the full functionality of get() in the reference in the Processing Foundation’s website.

I will also suggest to explore previous posts related to transferring data between devices in a client-server configuration. Transferring images is not as common in this forum, but you should be able to get some code to get you started. One last thing: The UDP library works for the java version of Processing on Desktop. It should work for R-pi’s as well. However, take this with a grain of salt as I do not work with those units.

Kf

1 Like

Much appreciated for explaining and sending the link.
To be 100% precise, i don’t want to transfer an image itself, but something more complex like this

In this case, am i still going the way you suggested ? Thanks and sorry for the mess.

You should be able to transfer an actual image generated in the server Raspberry Pi. Exchanging iamges just required an extra amount of work. Now, if all images are reproduced by some algorithm engine of yours, and if this algorithm engine is embedded in each Pi unit, then I could foresee sending only the parameters to drive the algorithm to generate the image instead of sending it. You could use for this the oscP5 library. You can check the examples and documentation

Kf

1 Like