Skip to content

Possible issue using filter() inside of PGraphics for Syphon in Processing? #41

@CaseyJNova

Description

@CaseyJNova

MacBook Pro Retina Mid-2015
OSX 11.5.1
Processing 3.5.4

I am using the Syphon Processing library and I have found a possible issue when it comes to using the filter() function inside of the PGraphics canvas for sending out frames via a Syphon Server.

I have noted that the filters used, BLUR & INVERT, do appear correctly in the Processing window however they do not appear to be sent out correctly in the Syphon output.

Is there a reason for this?

Possible solution or fix?

Or, should I try to apply the filters in a different manner altogether?

Thank you for any tips or help!

Please see code and screenshot below:

import codeanticode.syphon.*;

PGraphics canvas;
SyphonServer server;

void setup() { 
  size(400,400, P3D);
  canvas = createGraphics(400, 400, P3D);
  frameRate(30);
  
  // 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.filter(INVERT);
  canvas.filter(BLUR, 3);
  canvas.endDraw();
  image(canvas, 0, 0);
  server.sendImage(canvas);
}

Screen Shot 2022-01-28 at 3 19 44 PM

Activity

added this to the Version 4 milestone on Mar 12, 2022
codeanticode

codeanticode commented on Mar 12, 2022

@codeanticode
Contributor

It's actually the same as #32, since mask() just calls filter(). I think it's an upstream bug in the OpenGL renderer in Processing.

self-assigned this
on Mar 12, 2022
removed this from the Version 4 milestone on Mar 13, 2022
CaseyJNova

CaseyJNova commented on Mar 13, 2022

@CaseyJNova
Author

Nice work I appreciate the follow up. I took a look at #32 and found that to be a helpful description of the problem with the ordering of the "server.sendImage(canvas);" in the beginning being rather helpful.

I did notice that if I put it at the very start the Syphon output was good but the Processing window would be null. So I put it just after beginDraw()

The code below works great now and is shown in the screenshot.

Screen Shot 2022-03-13 at 3 25 19 PM

import codeanticode.syphon.*;

PGraphics canvas;
SyphonServer server;

void setup() { 
  size(400,400, P3D);
  canvas = createGraphics(400, 400, P3D);
  frameRate(30);
  
  // Create syhpon server to send frames out.
  server = new SyphonServer(this, "Processing Syphon");
}

void draw() {
  
  canvas.beginDraw();
  
  server.sendImage(canvas);
  
  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.filter(INVERT);
  canvas.filter(BLUR, 3);
  canvas.endDraw();
  image(canvas, 0, 0);
  
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @codeanticode@CaseyJNova

      Issue actions

        Possible issue using filter() inside of PGraphics for Syphon in Processing? · Issue #41 · Syphon/Processing