-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
noSmooth() breaks positioned WEBGL canvas #7548
Comments
A docs update sounds like the best option here for mentioning that the canvas will be recreated. About positioning: I don't think we try to copy the style attribute from the last canvas when we recreate it, so that would probably be necessary to not lose the position if |
Yup, setAttributes has a property that recreates the canvas, so updating the documentation of noSmooth() is a good option. Alternatively, we can update the codebase to prevent unnecessary canvas recreation by checking if antialias is already false before calling setAttributes(). This would improve performance, maintain canvas positioning, and ensure consistency between 2D and WebGL modes. Would it be okay to proceed with a pull request for this fix? |
I would like to work on this issue by modifying My Plan to Fix this issue:
Let me know if any changes are needed and should I proceed with a PR! |
@ImRAJAS-SAMSE, I think the change might not have fully resolved the issue as expected. The canvas position still seems to be off after calling noSmooth(). Could you double-check whether the position is being correctly restored after the canvas is recreated? |
Hi @HarshitaKatariya, thank you for reviewing the PR! 🙌 I double-checked the fix, and during testing, the canvas retained its position correctly after calling What I Tested:
Could you share a test case where the issue still occurs? I’d be happy to debug further if needed. |
Most appropriate sub-area of p5.js?
p5.js version
1.11.3
Web browser and version
Chrome 133.0.6943.54
Operating system
MacOS
Steps to reproduce this
Steps:
createCanvas()
, position it, addnoSmooth()
in thedraw()
Perhaps one isn't supposed to use
noSmooth()
in the draw? I don't remember hitting this issue, but maybe never tried it before... Is that how it's supposed to behave? The refs only show examples of it in thesetup()
, but it doesn't state anywhere that's the only spot for it to go. In 2D renderer, it doesn't cause an issue, so is it normal in WEBGL or a bug?Snippet:
The text was updated successfully, but these errors were encountered: