Open codeanticode opened 10 years ago
I don't see error when using both libs together, but sometimes, tablet events stop being received for a brief interval (a second or so), but then they resume:
import codeanticode.tablet.*;
import codeanticode.syphon.*;
SyphonServer server;
Tablet tablet;
boolean useCallback = false;
float pressure;
int levelEventCalls;
//String renderer = JAVA2D;
String renderer = P2D;
void settings() {
size(720, 720, renderer);
PJOGL.profile=1;
}
void setup() {
server = new SyphonServer(this, "Processing Syphon");
frameRate(120);
smooth(8);
tablet = new Tablet(this);
textFont(createFont("Arial", 30));
background(180);
}
void draw() {
stroke(0);
if (useCallback) strokeWeight(25 * pressure);
else strokeWeight(25 * tablet.getPressure());
if (mousePressed) {
line(mouseX, mouseY, pmouseX, pmouseY);
}
noStroke();
fill(255, 0, 0);
rect(0, 0, width, 50);
fill(255);
text(frameCount + " - " + levelEventCalls, 20, 40);
server.sendScreen();
}
void keyPressed() {
if (key == ' ') background(180);
else if (key == 'c') {
useCallback = !useCallback;
println("Using callback", useCallback);
}
}
void penLevelEvent(Tablet t) {
levelEventCalls++;
pressure = t.getPressure();
}
Users have reported errors when a sketch using Tablet also depends on the Syphon library:
http://forum.processing.org/two/discussion/655/syphon-tablet-error#Item_3