How to set background for PGraphics?

I'm trying to save an image from a PGraphics I've created, but I can't figure out how to change the background color of the PGrahics. It either comes out as black background or transparent. Any suggestions?


  • Answer ✓

    Simply use the background statement to clear the PGraphics object before drawing.

    pg.background(???);  // set the background colour
    // your drawing commands
  • yes! I forgot about beginDraw and endDraw, thanks!

Sign In or Register to comment.