I'm trying to create a single application that runs across two small 10" screens, both displaying at 800 x 600. After trolling the forums, I found a few suggestions on how to go about doing this, but am having two very different problems with each. If it's of any concern, I'm running 2.0 on OSX 10.6.8.
The first method that I tried I found on the
Processing Wiki, and seemed straightforward enough. I gave it a test run using a simple grid that stretched across both screens (still in the code) and it worked beautifully. However, as I started building my sketch, I ran into some problems. For whatever reason, when the static public void is implemented, I get
null pointer exceptions on both of my pShape objects, and big blank grey screen. If the
static public void is commented out, everything runs just fine...I'd love to know why this is happening, and how to fix it. Code is below:
PShape r_truck;
PShape b_truck;
static public void main(String args[]) {
Frame frame = new Frame("testing");
frame.setUndecorated(true);
PApplet applet = new no_pshapes(); //change to match sketch/program name
frame.add(applet);
applet.init();
frame.setBounds(0, 0, 1600, 600);
frame.setVisible(true);
}
void setup() {
size(1600, 600);
r_truck = loadShape("r_truck.svg");
b_truck = loadShape("b_truck.svg");
}
void draw() {
background(0);
stroke(255);
for (int i= 0; i <= height; i = i+ 50) {
line(0, i, width, i);
}
for (int i=0; i <= width; i = i + 50) {
line(i, 0, i, height);
}
r_truck.disableStyle();
b_truck.disableStyle();
shapeMode(CENTER);
strokeWeight(5);
stroke(#ebe9dd);
fill(#ed1a3b);
shape(r_truck, 100, 100);
fill(#3b60b0);
shape(b_truck, 300, 300);
}
The second method that I've tried I found in a discussion on the forums
here. This method has no conflicts at all when run normally, but, for whatever reason, gives me two big (or little, in this case) ol' blank screens when run in present mode or exported as an application. For whatever reason, as specified by calsign in the post above, I had to place
frame.setlocation in the
draw() loop in order to get it to function properly (window was widely askew without it). Code is as shown below:
PShape r_truck;
PShape b_truck;
public void init() {
frame.removeNotify();
frame.setUndecorated(true);
frame.addNotify();
super.init();
}
void setup() {
size(1600, 600);
//frame.setLocation(1000,1000);
r_truck = loadShape("r_truck.svg");
b_truck = loadShape("b_truck.svg");
}
void draw() {
if(frameCount == 1) frame.setLocation(0, 0);
background(0);
stroke(255);
for(int i= 0; i <= height; i = i+ 50){
line(0, i, width , i);
}
for(int i=0; i <= width; i = i + 50){
line(i, 0, i, height);
}
r_truck.disableStyle();
b_truck.disableStyle();
shapeMode(CENTER);
strokeWeight(5);
stroke(#ebe9dd);
fill(#ed1a3b);
shape(r_truck, 100, 100);
fill(#3b60b0);
shape(b_truck, 300, 300);
}
I'd love to know what's going wrong in both of these cases, or if I'm taking the wrong approach entirely here. Any help would be greatly appreciated. Thanks so much!