We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi everyone,
I've been having trouble with Processing. When I run certain patches such as this:
/**
* MoireCircles
* A simple moire effect to try out smooth 2d motion
* Mouse control: Click into the sketch to control the overlay with the mouse
*
* Joerg Reuter, jore[at]stachelig[dot]de
* Creative Commons Attribution 3.0 license
* http://stachelig.de
*/
int MAX_X = 640;
int MAX_Y = 360;
int frame = 0;
boolean interactive = false;
PGraphics mg;
Lissajous lissX;
Lissajous lissY;
void setup() {
size(640, 360, P2D);
createMoirePatternCircles();
lissX = new Lissajous(3, 28, -.01, 4, 15, .05, 2, 19, -.07);
lissY = new Lissajous(2, 18, -.01, 4, 12, .05, 3, 29, -.07);
}
void mousePressed() {
lissX = new Lissajous(
random(2,8), random(2,30), random(-.2, .2),
random(2,8), random(2,30), random(-.2, .2),
random(2,8), random(2,30), random(-.2, .2));
lissY = new Lissajous(
random(2,8), random(2,30), random(-.2, .2),
random(2,8), random(2,30), random(-.2, .2),
random(2,8), random(2,30), random(-.2, .2));
}
void draw() {
if(mousePressed)
interactive = !interactive;
float t = frame++ * 1.0; // use factor to slow down or speed up animation
image(mg, -MAX_X/2-lissX.get(t), -MAX_Y/2-lissY.get(t));
if(interactive)
blend(mg, 0, 0, MAX_X*2, MAX_Y*2, mouseX-MAX_X, mouseY-MAX_Y, MAX_X*2, MAX_Y*2, DIFFERENCE);
else
blend(mg, 0, 0, MAX_X*2, MAX_Y*2, int(-MAX_X/2-lissX.get(t+20)), int(-MAX_Y/2-lissY.get(t+25)), MAX_X*2, MAX_Y*2, DIFFERENCE);
}
// fill an image with concentric circles
void createMoirePatternCircles() {
mg = createGraphics(MAX_X*2, MAX_Y*2, P2D);
mg.beginDraw();
mg.background(0);
mg.noStroke();
mg.smooth();
int diag=int(sqrt(sq(MAX_X)+sq(MAX_Y)));
boolean odd=true;
for(int i=diag*2; i>0; i-=20) {
mg.fill(odd ? #ffffff : #000000);
mg.ellipse(MAX_X, MAX_Y, i, i);
odd = !odd;
}
mg.endDraw();
}
class Lissajous {
float freq1, freq2, freq3;
float amp1, amp2, amp3;
float dir1, dir2, dir3;
public Lissajous(float freq1, float amp1, float dir1, float freq2, float amp2, float dir2, float freq3, float amp3, float dir3) {
this.freq1 = freq1;
this.amp1 = amp1;
this.dir1 = dir1;
this.freq2 = freq2;
this.amp2 = amp2;
this.dir2 = dir2;
this.freq3 = freq3;
this.amp3 = amp3;
this.dir3 = dir3;
}
public float get(float t) {
return amp1*sin(freq1+dir1*t) + amp2*sin(freq2+dir2*t) + amp3*sin(freq3+dir3*t);
}
}
or this will produce runtime errors. I'll often be shown the sketch window and some of the animation will be drawn and then the window will crash and the error will appear.
// forum.Processing.org/two/discussion/22049/
// java-crashes-on-processing-when-trying-to-paint-something
// OpenProcessing.org/sketch/421196
// 2017-Apr-17
static final float A = 10, B = 28, C = 8/3.;
static final float DT = .01;
static final boolean IS_PJS = 1/2 == 1/2.;
float x = .1, y = .1, z = .1;
boolean paused;
void setup() {
size(800, 600, P3D);
smooth(4);
frameRate(60);
background(0);
stroke(#FF0000);
strokeWeight(5);
line(width>>1, height>>1, width, height);
stroke(#FF00FF);
if (!IS_PJS) strokeWeight(1);
}
void draw() {
final float dx = DT * (A * (y - x));
final float dy = DT * (x * (B - z) - y);
final float dz = DT * (x*y - C*z);
translate(width>>1, height>>1);
scale(5);
point(x += dx, y += dy, z += dz);
}
void mousePressed() {
if (paused ^= true) noLoop();
else loop();
}
They both have been posted on Open Processing and seem to run. The first one was made on an older version of Processing.
How can this be fixed? I'm running Processing 3.3 on OSX 10.9.5
Answers
Both of these ran for me without error. Processing 3.3 and Osx 10.12.4
What are the run time error messages?
for the first one:
and for the second one:
Seems pretty clear what the cause of those errors are - you graphics card, or the driver.
Line 6 would suggest It appears to be a problem OpenGL rendering. You might make sure your graphic card drivers are up to date.
Yeah, it seems like it's a problem for a lot of users https://github.com/processing/processing/issues/4104
As an update, I tried to seeing if there was a logic board fault (Apple did a replacement job for me, after I complained) but it seems like HD3000 graphics cards are not compatible with Processing 3. Processing 2 works fine though.