Skip to content

filter() incompatible with high pixel density on P2D and P3D #429

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

Closed
processing-bot opened this issue Mar 2, 2022 · 5 comments
Closed
Labels
has attachment Attachment was not transfered from GitLab help wanted Extra attention is needed opengl

Comments

@processing-bot
Copy link
Collaborator

Created by: HectorCarral

Description

Using filter() (for example, filter(GRAY), filter(INVERT)) in combination with a higher pixel density (set for example with pixelDensity(displayDensity())) behaves weirdly when using P2D or P3D.

Expected Behavior

The filter would be applied with P2D/P3D and high pixel density in the same way as with the default renderer or with default pixel density.

Current Behavior

The frame is drawn zoomed in on the top left corner. If the default renderer is used, everything works as expected. If no higher pixel density is used, everything works as expected. Interestingly, if we use saveFrame(), the saved image looks fine even though it is rendered wrong in Processing. Therefore, I'm attaching here screenshots instead of saved frames.

Default renderer or default pixel density:
Captura de pantalla 2022-03-02 a las 12 37 44

High pixel density and P2D/P3D:
Captura de pantalla 2022-03-02 a las 12 37 31

Steps to Reproduce

  1. Set P2D or P3D as the renderer.
  2. Set a high pixel density.
  3. Use filter().
void setup() {
  size(500, 500, P3D);
  pixelDensity(displayDensity());
  rectMode(CENTER);
  noLoop();
  
  background(0);
  noStroke();
  fill(255, 0, 0);
}

void draw() {
  rect(width*0.5, height*0.5, width*0.5, height*0.5);
  filter(GRAY);
}

Your Environment

  • Processing version: Processing 4.0b6 (x64)
  • Operating System and OS version: macOS 12.2.1
  • Other information: Apple M1 chip
@processing-bot
Copy link
Collaborator Author

Created by: codeanticode

@benfry just came across this, my quick take on how to fix it is in this PR #429 but I may be missing something.

@processing-bot
Copy link
Collaborator Author

Created by: codeanticode

I went through the filter examples in the reference, even tried a few more involved cases (rendering into a PGraphics and then applying the filter on the PGraphics object), and so far so good!

@processing-bot
Copy link
Collaborator Author

Created by: benfry

Ok, shall I merge or are you still checking?

@processing-bot
Copy link
Collaborator Author

Created by: codeanticode

I'm done checking, you can merge.

@processing-bot
Copy link
Collaborator Author

Created by: github-actions[bot]

This issue has been automatically locked. To avoid confusion with reports that have already been resolved, closed issues are automatically locked 30 days after the last comment. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
has attachment Attachment was not transfered from GitLab help wanted Extra attention is needed opengl
Projects
None yet
Development

No branches or pull requests

1 participant