hi
i need some help if you kind i want to add this 3d rects
to this sketch
int cols, rows;
int scl = 26;
int w = 2800;
int h = 2600;
boolean showImage = true;
PImage img;
void setup() {
size(800, 800, P3D);
cols = w / scl;
rows = h/ scl;
img = loadImage( "jaf.png");
texture(img);
noStroke();
}
float ax, ay;
void draw() {
lights();
background(64);
translate(width/2, height/2);
rotateY(map(mouseX, 0, width, -PI, PI));
rotateX(map(mouseY, 0, width, -PI, PI));
scale(0.2);
if (showImage) image(img, 220, 0);
translate(-w/2, -h/2);
for (int y = 0; y < rows-1; y++) {
if (showImage) image(img, 220, 0);
beginShape(TRIANGLE_STRIP);
if (showImage) image(img, 220, 0);
texture(img);
for (int x = 0; x < cols; x++) {
ax = map(x, 0, cols, 0, img.width);
ay = map(y, 0, rows, 0, img.height);
vertex(x*scl, y*scl, map(brightness(img.get(int(ax), int(ay))), 320, 255, 0, 200), ax, ay );
ax = map(x, 0, cols, 0, img.width);
ay = map(y+1, 0, rows, 0, img.height);
vertex(x*scl, (y+1)*scl, map(brightness(img.get(int(ax), int(ay))), 320, 255, 0, 200), ax, ay );
//rect(x*scl, y*scl, scl, scl);
}
endShape();
}
}
void mousePressed() {
showImage = !showImage;
}
how to include this sketch to the 3d grid rects
thanks in advance