Skip to content

multiple servers in one sketch #10

@clankill3r

Description

@clankill3r

I need to send different images to a client from one sketch.
If i run this and check with Simple Client (the app delivered with Syphon) then only one is updating. The other 2 are frozen.

import codeanticode.syphon.*;

PGraphics canvas;

SyphonServer[] servers;
int nServers = 3;

void setup() {
  size(400,400, P3D);
  canvas = createGraphics(400, 400, P3D);

  // Create syhpon servers to send frames out.
  servers = new SyphonServer[nServers];
  for (int i = 0; i < nServers; i++) { 
    servers[i] = new SyphonServer(this, "Processing Syphon."+i);
  }

}

void draw() {
  canvas.beginDraw();
  canvas.background(127);
  canvas.lights();
  canvas.translate(width/2, height/2);
  canvas.rotateX(frameCount * 0.01);
  canvas.rotateY(frameCount * 0.01);  
  canvas.box(150);
  canvas.endDraw();
  image(canvas, 0, 0);

  int currentServer = frameCount % nServers;

  servers[currentServer].sendImage(canvas);
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions