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

WebGL filters display at the wrong size when the rect mode is changed #6602

Closed
1 of 17 tasks
davepagurek opened this issue Dec 1, 2023 · 2 comments · Fixed by #6603
Closed
1 of 17 tasks

WebGL filters display at the wrong size when the rect mode is changed #6602

davepagurek opened this issue Dec 1, 2023 · 2 comments · Fixed by #6603
Assignees

Comments

@davepagurek
Copy link
Contributor

Most appropriate sub-area of p5.js?

  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • WebGL
  • Build Process
  • Unit Testing
  • Internalization
  • Friendly Errors
  • Other (specify if possible)

p5.js version

1.9.0

Web browser and version

Firefox 117

Operating System

MacOS 14

Steps to reproduce this

Steps:

  1. Draw something
  2. Change the rect mode to something non-default, e.g. CORNERS
  3. Apply a filter, such as filter(BLUR, 10)

The resulting image is offset and scaled.

Note that in addition to fixing this, we should include new tests, since this area of the code is clearly pretty brittle to these environment changes, and it's infeasible to test them all manually.

Snippet:

function setup() {
  createCanvas(400, 400, WEBGL)
}

function draw() {
  background(220)
  circle(0, 0, 100)
  // Comment this out to fix
  rectMode(CORNERS)
  filter(BLUR, 10)
}

https://editor.p5js.org/davepagurek/sketches/OFRDKVzm_

@davepagurek davepagurek added the Bug label Dec 1, 2023
@davepagurek davepagurek self-assigned this Dec 1, 2023
@perminder-17
Copy link
Contributor

perminder-17 commented Dec 1, 2023

Ooh..Good catch... Setting the rect-mode of the canvas explicitly before drawing the image can may fix this I guess?

@Metamere
Copy link

Metamere commented Dec 1, 2023

Yes, that workaround fixes it. I asked Dave for help with this issue earlier today, and he submitted the bug report after figuring out the cause.

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

Successfully merging a pull request may close this issue.

3 participants