noSmooth() breaks positioned WEBGL canvas
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 24k
- Forks
- 3.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 25
Description
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
- Internationalization
- Friendly errors
- Other (specify if possible)
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()- 2D renderer, no problem
- WEBGL, breaks, creates new empty canvas?
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 the setup(), 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:
function setup() {
let cvn = createCanvas(300, 300)
cvn = createCanvas(300, 300, WEBGL) // breaks with noSmooth() below
cvn.position(150, 50)
background(0, 0, 255)
circle(0, 0, 100)
}
function draw(){
noSmooth() // breaks sketch in WEBGL mode
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the supplied p5.js 1.11.3 snippet in Chrome and compare the positioned 2D and WEBGL canvases when noSmooth() is called in draw(). Trace the WebGL rendering behavior around noSmooth() and canvas positioning. Done means establishing the intended behavior and correcting the empty-canvas failure, with a regression check for the reported case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100