I am having trouble using saveFrame to record a sketch which uses p3d with a background image. When I use saveFrame without the background image everything is captured fine and shows the sketch but when I put the background image in it only records the background image. I am very new to coding and using processing so sorry if this is too simplistic. Any help would be great.
PImage bg;
int y;
int cols, rows;
int scl = 20;
int w = 2500;
int h = 3000;
float flying = 0;
float[][] terrain;
void setup() {
size (800, 533, P3D);
cols = w/scl;
rows = h/scl;
terrain = new float[cols][rows];
bg = loadImage("Glacier_Processing.jpg");
}
void draw() {
background(bg);
flying -= 0.07;
float yoff = flying;
for (int y = 0; y < rows; y++) {
float xoff = 0;
for (int x = 0; x < cols; x++) {
terrain[x][y] = map(noise(xoff,yoff), 0, 1, -250, 100);
xoff += 0.2;
}
yoff += 0.2;
saveFrame("output3/glacier_####.jpeg");
}
strokeWeight(.45);
stroke(0, 100, 250, 75);
noFill();
translate(width/2, height/2);
rotateX (PI/3.65);
translate(-w/2, -h/2);
for (int y = 0; y < rows-1; y++) {
beginShape(TRIANGLE_STRIP);
for (int x = 0; x < cols; x++) {
vertex(x*scl, y*scl, terrain[x][y]);
vertex(x*scl, (y+1)*scl, terrain[x][y+1]);
//rect(x*scl, y*scl, scl, scl);
}
endShape();
}
}```