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
set canvas to specific size, ie. createCanvas(400, 400
fb = get(0, 0, width, height) to grab the whole canvas
check size of of print(fb.width), returns 800...
I loooove using visual feedback in p5.js, using get() to grab the image at the end of the draw, and place it back at the top of the draw scaled or rotated... just tried loading some works i had made the past weeks after updating to 1.8.0 and nothing worked.. computer ran slow.. no feedback, weird.. tested code in v1.7.0 and voila, worked great again. Turns out there's a bug? in v1.8.0 for the get() function that's doubling the image size... probably has something to do with the pixelDensity or some new WEBGL(2?) aspect of the canvas?? I know by default when one says createCanvas(400, 400) it's actually 800,800 on a retina display unless using pixelDensity(1).. however it seems like a bug that the get() image size is that doubled size compared to that of the canvas. I think the 3rd example for get() in the docs even looks different than expected.. it's asking for half the image, but showing 1/4 of it due to the scaling issue. Change the demo code with the following two lines and the problem is clear:
letc=get(0,0,width/2,height/2);image(c,0,0);
Aaand digging into the render js, found the change that is causing it! Curious if/why or for what other function this needed to change...
@davepagurek@Gaurav-1306 – curious if you also experience the issue mentioned above. I tracked down the commit that changed the get() along with similar changes for pixelDensity(), which came out of this issue.
oh I bet it's because the next line is region._pixelDensity = pd; instead of region.pixelDensity(pd); -- the latter should divide the width and height back again:
Most appropriate sub-area of p5.js?
p5.js version
1.8.0
Web browser and version
119.0.6045.123
Operating System
MacOSX 12.5.1
Steps to reproduce this
Steps:
createCanvas(400, 400
fb = get(0, 0, width, height)
to grab the whole canvasprint(fb.width)
, returns 800...I loooove using visual feedback in p5.js, using
get()
to grab the image at the end of the draw, and place it back at the top of the draw scaled or rotated... just tried loading some works i had made the past weeks after updating to 1.8.0 and nothing worked.. computer ran slow.. no feedback, weird.. tested code in v1.7.0 and voila, worked great again. Turns out there's a bug? in v1.8.0 for theget()
function that's doubling the image size... probably has something to do with the pixelDensity or some new WEBGL(2?) aspect of the canvas?? I know by default when one sayscreateCanvas(400, 400)
it's actually800,800
on a retina display unless usingpixelDensity(1)
.. however it seems like a bug that theget()
image size is that doubled size compared to that of the canvas. I think the 3rd example forget()
in the docs even looks different than expected.. it's asking for half the image, but showing 1/4 of it due to the scaling issue. Change the demo code with the following two lines and the problem is clear:Aaand digging into the render js, found the change that is causing it! Curious if/why or for what other function this needed to change...
Here's a basic example Example:
https://editor.p5js.org/ffd8/sketches/SUf60UZhg
Snippet:
The text was updated successfully, but these errors were encountered: