// By Scott Brown 16 October 2009 // http://kodama.angrypixel.org // // Multi-screen output from Andres Colubri's 'TextureWindow' import processing.opengl.*; import codeanticode.glgraphics.*; import codeanticode.gsvideo.*; GLTexture srcTex, destTex; GLTextureFilter invert; GLTextureWindow texWin; GSCapture cam; int numPixels; float mouseDist = 50.0; void setup() { size(1000, 600, GLConstants.GLGRAPHICS); background(0); cam = new GSCapture(this, 640, 480, 24); numPixels = cam.width * cam.height; invert = new GLTextureFilter(this, "MouseInvert.xml"); srcTex = new GLTexture(this); destTex = new GLTexture(this); smooth(); } void draw() { if (cam.available()) { cam.read(); cam.loadPixels(); loadPixels(); srcTex.putPixelsIntoTexture(cam); // Mouse coordinates need to be mapped to the texture size: float x = map(mouseX, 25, 665, 0, srcTex.width); float y = map(mouseY, 25, 505, 0, srcTex.height); invert.setParameterValue("mpos", new float[]{x, y}); invert.setParameterValue("mdist", mouseDist); invert.apply(srcTex, destTex); // The last line is equivalent to: // srcTex.filter(invert, destTex); image(destTex, 25, 25, 640, 480); } }