Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
CaseyJScalf opened this issue Jan 28, 2022 · 2 comments
Assignees
Labels

Comments

@CaseyJScalf
Copy link

CaseyJScalf commented Jan 28, 2022

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

@codeanticode codeanticode added this to the Version 4 milestone Mar 12, 2022
@codeanticode
Copy link
Member

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.

@codeanticode codeanticode self-assigned this Mar 12, 2022
@codeanticode codeanticode removed the bug label Mar 13, 2022
@codeanticode codeanticode removed this from the Version 4 milestone Mar 13, 2022
@CaseyJScalf
Copy link
Author

CaseyJScalf commented Mar 13, 2022

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
Labels
Projects
None yet
Development

No branches or pull requests

2 participants