Skip to content

Conversation

@Rudrxxx
Copy link

@Rudrxxx Rudrxxx commented Nov 21, 2025

Resolves #8264

Changes:

This PR fixes a crash when calling noSmooth() on a p5.Graphics object in p5.js 2.0, which previously resulted in:

What was done:

  • Updated src/shape/attributes.js to safely route through
    renderer.setSmoothing(false) when available.
  • Added a fallback that manually disables
    drawingContext.imageSmoothingEnabled for cases where setSmoothing or setAttributes do not exist.
  • Ensures noSmooth() works consistently on:
    • Main canvas (2D)
    • p5.Graphics 2D buffers
    • p5.Graphics WebGL buffers (the crash case)

Manual test pages added:

  • test/manual/noSmooth/canvas-2d.html
  • test/manual/noSmooth/graphics-webgl.html

These test pages verify that noSmooth() runs without errors and logs success messages in the console.


Screenshots of the change:

Console output after fix:

  • Main Canvas (2D):
    Main Canvas: noSmooth OK

  • WebGL p5.Graphics:
    WebGL p5.Graphics: noSmooth OK

No crashes, no TypeErrors.


PR Checklist

@welcome
Copy link

welcome bot commented Nov 21, 2025

🎉 Thanks for opening this pull request! For guidance on contributing, check out our contributor guidelines and other resources for contributors!
🤔 Please ensure that your PR links to an issue, which has been approved for work by a maintainer; otherwise, there might already be someone working on it, or still ongoing discussion about implementation. You are welcome to join the discussion in an Issue if you're not sure!
🌸 Once your PR is merged, be sure to add yourself to the list of contributors on the readme page !

Thank You!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant