Hi guys,
I'm working on a project which requires me to draw in the control window, then save the images out using saveFrame. I'm unable to draw in the control window because i can't seem to get the control window to stop updating (setDrawBackground not working??)
here's the basic outline, thanks in advance
- import controlP5.*;
- ControlWindow controlwindow;
- ControlWindowCanvas cc;
- ControlP5 controlP5;
- void setup() {
- size(1024, 768);
- controlP5 = new ControlP5(this);
- controlwindow = controlP5.addControlWindow("controlP5window", 100, 100, 400, 768);
- controlwindow.setBackground(color (0));
- controlwindow.setDrawBackground(false); //this not working?
- cc=new EmpCan();
- cc.post();
- controlwindow.addCanvas(cc);
- }
- void draw() {
- }
- class EmpCan extends ControlWindowCanvas {
- public void setup(PApplet theApplet) {
- theApplet.background(0);
- }
- public void draw(PApplet theApplet) {
- //create an image(from processing site)
- PImage img = createImage(66, 66, RGB);
- img.loadPixels();
- for (int i = 0; i < img.pixels.length; i++) {
- img.pixels[i] = color(0, 90, 102);
- }
- img.updatePixels();
- //add it to draw
- image(img, 17, 17);
- //add it to canvas
- theApplet.image(img,0,0);
- theApplet.image(img, theApplet.width, theApplet.width);
- //draw ellipses in the Control Window(NOT WORKING)
- if (theApplet.mousePressed) {
- theApplet.fill(255, 100, 0);
- theApplet.ellipse(theApplet.mouseX, theApplet.mouseY, 20, 20);
- }
- //draw ellipses in the main window(WORKS)
- if (theApplet.mousePressed) {
- fill(255, 100, 0);
- ellipse(theApplet.mouseX, theApplet.mouseY, 20, 20);
- }
- //this doesn't work either?
- }
- public void mouseReleased(PApplet theApplet) {
- saveFrame();
- println("yay");
- }
- }
1