Using Processing in a gallery context

I’m looking into setting up a series of screens that would each run a piece of creative coding. One option is to have each screen attached to its own computer, something small. The other option is setting up a media server that would connect to several screens. There are, for now, two different approaches to content: one is written in javascript and would be browser based, the other is written in Processing. I’ve briefly looked at Raspberry Pi, but we want to use something more robust like a Mac mini or a small PC.

Specifically regarding Processing, I’ve looked at exporting a freestanding application with mixed results. Simply can’t get it to work for some setups. The sketches are nothing too complicated, and for now do not reference any external libraries.

Do you have experience setting up or running Processing creations on a series of screens (or even one?). Could you please give me some insight or point me in a direction?

Thanks

1 Like

Hi @Christiaan,

Welcome to the forum! :wink:

Are the different sketches completely different or they are random variations of the same pattern/sketch?

One solution would be to setup a web server with your p5js code (or host it online) and then connect each computer to the online sketch.

For multi screen setup I don’t have experience with it so I’ll let someone answer :yum:

2 Likes

It’s probably best to use Processing outside the processing IDE for this, so you can instantiate multiple different sketches and them run all the same time (on different screens) from one application.

Here’s an example with two sketches, running on monitors 1 and 2 respectively.

public class App {

	public static void main(String[] args) {
		var a = new SketchA();
		var b = new SketchB();
		PApplet.runSketch(new String[]{"a"}, a);
		PApplet.runSketch(new String[]{"b"}, b);
	}

}
public class SketchA extends PApplet {

	@Override
	public void settings() {
		fullScreen(JAVA2D, 1);
	}

	@Override
	public void draw() {
		background(0, 255, 0);
	}

}
public class SketchB extends PApplet {

	@Override
	public void settings() {
		fullScreen(JAVA2D, 2);
	}

	@Override
	public void draw() {
		background(255, 0, 0);
	}

}
2 Likes

That looks a great idea :smiley:

Thank you for your reply. If you don’t mind, I’d like to follow up with some questions for clarification.

When you mention using Processing outside of its IDE, you’re referring to java? Or perhaps p5.js?

These classes that you’ve written make sense to me logically, but could you give me a bit more context? I.e., they would be exported as different documents, or they are part of the same file, exported as .java perhaps?

Thanks again.

Hi Joseph, thank you. It’s great to be here. Started getting into Processing at the start of the year and it’s been illuminating.

I don’t have a particular sketch at the moment, been creating and experimenting, and would like to take a select few further to display.

I’m considering moving over to p5js as this may be a more streamlined way to display work.

1 Like

Yes this is using Processing (Java) as a Java library outside the Processing IDE (since the PDE abstracts away the main function, etc.)

Each of the 3 code blocks could be separate .java files within the same project.