Hello, I’m trying to implement the Keystone library into a sketch I am using to do visuals at a show tonight.
The sketch is somewhat complex, and involves control with monome hardware, but I think I can boil down the essence of the problem. The full code is here: https://github.com/Upow1234/Processing-Sketches/tree/master/shapes_feedback
The shapes_feedback file is the one containing setup() and draw().
I have a global PGraphics context ‘pg’ that I am passing into a class ‘Five_Circles’ where the drawing is done to ‘pg’.
When I try to add the keystone library, everything seems to work ok, except that the output image will only display in the keystone editing mode and not in the non-edting mode. The editing mode is toggled with the ‘c’ keyboard key.
Below is essentially what I’ve done. I updated all the renderers from P2D to P3D. I tried all kinds of things changing around how ‘pg’ is passed into the class, even hard coding it in, and also trying to return a PGraphics from the class and assigning it to pg. All to no avail.
import deadpixel.keystone.*;
Keystone ks;
CornerPinSurface surface;
import org.monome.Monome;
import oscP5.*;
Monome grid;
Monome arc;
Monome_Parameters mp;
PGraphics pg;
int pgWidth = 1280;
int pgHeight = 1024;
Five_Circles fiveCircles;
//Expanding_Square exsqua;
Feedback feedback;
void setup() {
fullScreen(P3D, 2);
//size(320, 240, P2D);
pg = createGraphics(pgWidth, pgHeight, P3D);
feedback = new Feedback(200);
arc = new Monome(this, "m1100144");
grid = new Monome(this, "m1000370");
fiveCircles = new Five_Circles(pg, pgWidth, pgHeight);
//exsqua = new Expanding_Square(pg, pgWidth, pgHeight);
mp = new Monome_Parameters(grid, arc, fiveCircles);
//mp = new Monome_Parameters(grid, arc, exsqua);
ks = new Keystone(this);
surface = ks.createCornerPinSurface(width, height, 20);
}
void draw() {
pg.beginDraw();
pg.background(0);
feedback.feedbackDisplay(pg);
feedback.parameters(fiveCircles);
//feedback.parameters(exsqua);
fiveCircles.render();
//exsqua.render();
//println("frame rate = " + frameRate);
pg.endDraw();
//fiveCircles.display();
//exsqua.display();
feedback.feedbackCapture(pg);
feedback.count();
surface.render(pg);
}
void keyPressed() {
switch(key) {
case 'c':
// enter/leave calibration mode, where surfaces can be warped
// and moved
ks.toggleCalibration();
break;
case 'l':
// loads the saved layout
ks.load();
break;
case 's':
// saves the layout
ks.save();
break;
}
}
I hope someone can help! Thank you very much!!!