Syphon and processing

hi!

Im using Syphon and the syphon library to send the canvas from processing to VJ software Resolume Avenue.

As it is know I have to with the Syphon library in processing create PGraphics object and then send all the canvas to the server as with the example code below. But I wounder if there are no more straightforward solution that dont forces me to rewrite the sketch I want to send so I dont have to make everything into PGraphics but instead just send the sketch window straight ahead to syphon so I dont need to rewrite everything like below:

canvas.beginDraw();
canvas.background(127);
canvas.lights();
canvas.translate(width/2, height/2);

and so on ..

the perfect scenario and easiest would be to just write something like server.sendImage(mySketchWindow); without being forced to use PGraphics

Is this possible in any way?

Here is the sample code: import codeanticode.syphon.*;

PGraphics canvas;
SyphonServer server;

void settings() {
  size(400,400, P3D);
  PJOGL.profile=1;
}

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

  // Create syhpon server to send frames out.
  server = new SyphonServer(this, "Processing Syphon");
}

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);
  server.sendImage(canvas);
}
Tagged:

Answers

  • PerPer
    Answer ✓

    Sorry. Found the solution in another example in the syphon library.

    import codeanticode.syphon.*;
    
    SyphonServer server;
    
    void settings() {
      size(400,400, P3D);
      PJOGL.profile=1;
    }
    
    void setup() {
      // Create syhpon server to send frames out.
      server = new SyphonServer(this, "Processing Syphon");
    }
    
    void draw() {
      background(127);
      lights();
      translate(width/2, height/2);
      rotateX(frameCount * 0.01);
      rotateY(frameCount * 0.01);  
      box(150);
      server.sendScreen();
    }
    
Sign In or Register to comment.