Using PGraphics for Off-Screen Buffers in Processing: Layered Drawing and Performance Gains
PGraphics lets you cache static drawing layers in an off-screen buffer, then composite them each frame with a single image() call. This guide shows a complete worked example, explains memory limits, and lists the common mistakes that cause crashes or visual artifacts.