// Multi-screen output from Andres Colubri's 'TextureWindow' import processing.opengl.*; import codeanticode.glgraphics.*; import codeanticode.gsvideo.*; GLTextureWindow texWin; GSCapture cam; PFont font; boolean cam01 = false; boolean cam02 = false; boolean fx01 = false; boolean fx02 = false; boolean fx03 = false; boolean fx04 = false; boolean fx05 = false; boolean fx06 = false; void setup() { size(1100, 850, GLConstants.GLGRAPHICS); background(175); // For labels font = loadFont("Helvetica-18.vlw"); textFont(font); // Start camera cam = new GSCapture(this, 400, 300); // The window is located at (0, 0) and has a size of (400, 400). // Important: the texture window has be be created before creating any // texture, filter or any other OpenGL-related element. texWin = new GLTextureWindow(this, 0, 0, 400, 300); // A call to init() is required at the end of setup. texWin.init(); // If setting the override property of the texture window to // false, then it won't be drawn automatically. In this case, // it can be manually updated after the main draw is finished // using the post event (uncomment the post() function at the // bottom of this example): texWin.setOverride(true); registerPost(this); } void draw() { noStroke(); noFill(); // Camera windows if (cam01) { fill(255, 0, 0); rect(98, 48, 404, 304); text("Camera 01", 100, 370); } else { fill(0); rect(98, 48, 404, 304); text("Camera 01", 100, 370); } if (cam02) { fill(255, 0, 0); rect(98, 398, 404, 304); text("Camera 02", 100, 720); } else { fill(0); rect(98, 398, 404, 304); text("Camera 02", 100, 720); } // Effect windows fill(0); rect(598, 48, 404, 304); text("Effect", 600, 370); if (fx01) { fill(255, 0, 0); rect(598, 423, 104, 104); text("FX1", 600, 545); } else { fill(0); rect(598, 423, 104, 104); text("FX1", 600, 545); } if (fx02) { fill(255, 0, 0); rect(750, 425, 100, 100); text("FX2", 750, 545); } else { fill(0); rect(750, 425, 100, 100); text("FX2", 750, 545); } if (fx03) { fill(255, 0, 0); rect(900, 425, 100, 100); text("FX3", 900, 545); } else { fill(0); rect(900, 425, 100, 100); text("FX3", 900, 545); } if (fx04) { fill(255, 0, 0); rect(600, 575, 100, 100); text("FX4", 600, 695); } else { fill(0); rect(600, 575, 100, 100); text("FX4", 600, 695); } if (fx05) { fill(255, 0, 0); rect(750, 575, 100, 100); text("FX5", 750, 695); } else { fill(0); rect(750, 575, 100, 100); text("FX5", 750, 695); } if (fx06) { fill(255, 0, 0); rect(900, 575, 100, 100); text("FX6", 900, 695); } else { fill(0); rect(900, 575, 100, 100); text("FX6", 900, 695); } // Slider stroke(0); strokeWeight(3); line(100, 775, 1000, 775); if (cam.available() == true) { cam.read(); set(100, 50, cam); } } void mousePressed() { if (mouseX > 100 && mouseX < 500 && mouseY > 50 && mouseY < 350 && mousePressed) { cam01 = !cam01; if (cam01) { cam02 = false; } } if (mouseX > 100 && mouseX < 500 && mouseY > 400 && mouseY < 700 && mousePressed) { cam02 = !cam02; if (cam02) { cam01 = false; } } if (mouseX > 600 && mouseX < 700 && mouseY > 425 && mouseY < 525 && mousePressed) { fx01 = !fx01; } if (mouseX > 750 && mouseX < 850 && mouseY > 425 && mouseY < 525 && mousePressed) { fx02 = !fx02; } if (mouseX > 900 && mouseX < 1000 && mouseY > 425 && mouseY < 525 && mousePressed) { fx03 = !fx03; } if (mouseX > 600 && mouseX < 700 && mouseY > 575 && mouseY < 675 && mousePressed) { fx04 = !fx04; } if (mouseX > 750 && mouseX < 850 && mouseY > 575 && mouseY < 675 && mousePressed) { fx05 = !fx05; } if (mouseX > 900 && mouseX < 1000 && mouseY > 575 && mouseY < 675 && mousePressed) { fx06 = !fx06; } } void post() { texWin.render(); }