I’m using the Java version for Processing and I’ve been following a tutorial on PGraphics which uses p5.js. At one point, they initialize the background for the PGraphics layer in setup. However, when I try it, it produces a null pointer error. I also tried using the P2D renderer, but it doesn’t solve the problem. Here’s a simplified example showing the problem:
PGraphics pg;
void setup() {
size(600, 400);
pg = createGraphics(600, 400);
pg.background(0);
}
This doesn’t make any sense to me, since I’m pretty sure I’ve copied the code exactly, even though the example was in p5.js. Did I miss something obvious? Thanks for the help.