-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Closed
Labels
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
- Internalization
- Friendly Errors
- Other (specify if possible)
p5.js version
1.6.0
Web browser and version
Chrome 114, Safari 15.6
Operating System
MacOS 12.5.1
Steps to reproduce this
It seems like WebGL contexts don't get removed when you .remove() a p5.Graphics.
I have this test code, which creates and then removes a WebGL graphic 100 times:
function setup() {
createCanvas(400, 400, WEBGL);
for (let i = 0; i < 100; i++) {
const g = createGraphics(width, height, WEBGL);
g.remove();
}
}Live: https://editor.p5js.org/davepagurek/sketches/OSDIjBSgz
There should only ever be at most 2 contexts alive at a time, as I remove each before creating the next one, but instead, Chrome and Safari get this warning:
If you wanted to keep using the main canvas, this would cause an error, as it (being the oldest context) gets lost. Interestingly, it seems like Firefox 114 does not have this problem for me, so it seems browser-dependent. Regardless, it would be great if there were a way to avoid this in Chrome/Safari.
Reactions are currently unavailable
