We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi guys, I've been playing around with p5.js, it's great! I've made a version of Langton's Ant which scales up the image. Although I've put in noSmooth() the result is still horribly blurred. Do you have any recommendations on how to fix this?
img.loadPixels();
for(var i = 0; i < img.width; i++) {
for(var j = 0; j < img.height; j++) {
if (c[i][j]>0)
{
//var h = (c[i][j]*92)%255;
img.set(i, j, cul[c[i][j]-1]);
}
}
}
img.updatePixels();
image(img, 0,0,400,400);
Answers
This is the code in full. Also, while I'm asking, lines 56 to 61 (i've commented them) seem to be taking a long time to execute, do you have any idea on how to speed things up?
You fool! Did you stop to think at all before posting??
I'd still like to know about speeding thing up a bit ;)
hmmmm, I had a look at the timeline in devmode and it looks like the the script is being executed with 99% idle time, which I take to mean the computer is doing nothing at this time! I tried setting the frame rate to 900 but it makes no difference...
Slow execution is a common enough complaint (an example); particularly when iterating over every pixel of an (often large) image.
There may be gains to be made by using webGL - even in 2d operations (as an example see pixijs) though not sure how far p5js webGL development has got...