-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTrypticTester.pde
48 lines (41 loc) · 1.11 KB
/
TrypticTester.pde
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Use in combination with MultipleClients
import codeanticode.syphon.*;
int nServers = 2;
PGraphics[] canvas;
SyphonServer[] servers;
color[] colors;
void settings() {
size(320, 480, P3D);
PJOGL.profile = 1;
}
void setup() {
canvas = new PGraphics[nServers];
for (int i = 0; i < nServers; i++) {
canvas[i] = createGraphics(320, 240, P3D);
}
colors = new color[2];
colors[0] = color(255, 0, 0);
colors[1] = color(0, 255, 0);
String[] names = new String[2];
names[0] = "Front";
names[1] = "Back";
// Create syhpon servers to send frames out.
servers = new SyphonServer[nServers];
for (int i = 0; i < nServers; i++) {
servers[i] = new SyphonServer(this, names[i]);
}
}
void draw() {
for (int i = 0; i < nServers; i++) {
canvas[i].beginDraw();
canvas[i].background(colors[i]);
canvas[i].lights();
canvas[i].translate(canvas[i].width/2, canvas[i].height/2);
canvas[i].rotateX(frameCount * 0.01);
canvas[i].rotateY(frameCount * 0.01);
canvas[i].box(100);
canvas[i].endDraw();
image(canvas[i], 0, 240 * i);
servers[i].sendImage(canvas[i]);
}
}