PImage sprite;
int size = 10;
void setup() {
sprite = loadImage("sprite_10.png");
size(500, 500, P3D);
ortho();
noStroke();
noSmooth();
}
void draw() {
background(255);
loadPixels();
sprite.loadPixels();
println("____________");
for (int xr = 0; xr < size; ++xr) {
for (int yr = 0; yr < size; ++yr) {
//println("X: "+(id+xr)+"Y: "+yr);
color c1 = sprite.pixels[((yr)*(40))+(xr)];
if (brightness(c1) > 250) {
print("X");
} else {
print("0");
}
//println(brightness(c1));
fill(0);
text(xr+":"+yr, 30+xr*25, 30+yr*25);
fill(c1);
rect(30+xr*25, 30+yr*25, 25, 25);
pixels[((yr)*width)+(+xr)] = c1;
}
println("");
}
updatePixels();
}
I have an 40x10 image and i want to use it as a sprite sheet to apply an ascii filter. Thing is, i need to use a 3D scene and then apply the filter. Right now this is my test .pde, and im trying to get the image to show up correctly (its thickening the pixels, but only if i update the pixel grid, if i just draw rectangles it works fine).
Here is the image:
I encourage you to switch from P3D to regular render and notice how that also seems to work properly.
I sent to the console the pixels, and it shows them thickened.
Quite weird behaviour… Any help is much apreciated!