You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In draw(), mask the image onto the video using the mask function.
Check the console for the warning: "Canvas2D: Multiple readback operations using getImageData are faster with the willReadFrequently attribute set to true."
Hi! This isn't actually a bug, just a warning from the browser, so if you're satisfied with the performance as is, you can safely ignore this.
If you want better performance: mask loops over pixels, which is likely to be slower than other methods. If you're in WebGL mode, consider using a shader to do the masking. (Perhaps now that we have filter shader support in both 2D and WebGL mode, we could make a default filter shader for this?) Alternatively, you could make a p5.Graphics, draw the image to that, call graphic.drawingContext.globalCompositeOperation = 'destination-in', and then draw the mask image, then draw the graphic to the main canvas.
Most appropriate sub-area of p5.js?
p5.js version
1.8.0
Web browser and version
Chrome 119.0.6045.160
Operating System
Windows 11
Steps to reproduce this
Steps:
Snippet:
The text was updated successfully, but these errors were encountered: