package main; import processing.core.*; import processing.video.*; public class VideoOpenGLTest_Java1_5 extends PApplet { static final long serialVersionUID = 0; private Capture capture; private boolean bNewFrame = false; private final boolean USE_OPENGL = false; private final boolean VID_PLAYER_ACTIVE = true; public void init () { super.init(); } public void setup () { if (USE_OPENGL) { size(400, 300, OPENGL); } else { size(400, 300, P2D); } if (VID_PLAYER_ACTIVE) { println("INIT CAP"); try { capture = new Capture(this, 400, 300, 30); println(Capture.list()); } catch (Exception e) { println("Capture Exception:"+e); } } println("SETUP COMPLETE"); } public void draw () { if (VID_PLAYER_ACTIVE) { // display video if (bNewFrame) { image(capture, 0, 0, 400, 300); bNewFrame = false; } } else { // simple interaction to make sure things are up and running background(150, 0, 0); stroke(255); if (mousePressed) { line(mouseX, mouseY, pmouseX, pmouseY); } } } public void captureEvent (Capture cap) { cap.read(); bNewFrame = true; } public static void main (String args[]) { PApplet.main(new String[] { "main.VideoOpenGLTest_Java1_5" }); } }