Show ControlP5 controllers in screenshots

By default ControlP5 doesn't show controllers when you use saveFrame(). Is there an easy way to make it show them? I couldn't see anything in the JavaDoc.

Thanks :)

Tagged:

Answers

  • Answer ✓

    Hi, the code below will do the trick - disable auto draw in setup() then call cp5.draw() from within the sketch's draw() function.

    import controlP5.*;
    
    ControlP5 cp5;
    
    void setup() {
      size(400,400);
      cp5 = new ControlP5(this);
      cp5.setAutoDraw(false);
      cp5.addSlider("slider").setPosition(10,10).setSize(200,20);
    }
    
    void draw() {
      background(0);
      cp5.draw();
      if(keyPressed) saveFrame();
    }
    
  • Brilliant, thank you!

Sign In or Register to comment.