Java crashes on Processing when trying to paint something

Hi all,

I'm new to Processing and trying to recreate other people's code examples to learn. I'm currently following The Coding Train's example of animating a Lorenz Attractor using point().

My calculations are correct for equating the x, y, z of the system parameters. However, when I try to draw the x, y, and z parameters as a point() in cartesian space, Java crashes. I receive the following message in the Processing console:

0.1 0.1269 0.097433336

A fatal error has been detected by the Java Runtime Environment:

SIGSEGV (0xb) at pc=0x00001234002e318b, pid=1401, tid=0x000000000000db0f

JRE version: Java(TM) SE Runtime Environment (8.0_111-b14) (build 1.8.0_111-b14) Java VM: Java HotSpot(TM) 64-Bit Server VM (25.111-b14 mixed mode bsd-amd64 compressed oops) Problematic frame: C [AppleIntelHD3000GraphicsGLDriver+0x2e318b] gldBlitFramebufferData+0x3f8 (etc.)

I have tried to carefully check the code but I'm clueless as to why this is happening. I have tried drawing with rect() and other 2D shapes but they all cause Java to poop itself. The sketch runs fine no shapes are being drawn.

I have attached the patch here: https://ufile.io/bhnr3

I'm running Processing 3.3 with Mac OSX 10.9.5.

Tagged:

Answers

  • edited August 2017

    No crashes for me! Made some tweaks and posted online: :bz
    https://OpenProcessing.org/sketch/421196

    /**
     * Lorenz Atractor (v1.0)
     * Mod: GoToLoop (2017-Apr-17)
     *
     * Forum.Processing.org/two/discussion/22049/
     * java-crashes-on-processing-when-trying-to-paint-something#Item_1
     *
     * OpenProcessing.org/sketch/421196
     */
    
    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();
    }
    
  • i would ditch the println() - too much output makes processing barf.

    I have attached the patch

    just paste it here, it's not very long.

  • Hmmm, I'm still getting the same problem regardless of whether I use your code GoToLoop or if I just remove println()

    I'm not sure how to debug this ...

  • As some further info, I have found that Processing will crash when a shape is made in the draw() function. Shapes drawn in setup() will cause the crash. If I comment out the code for shapes made in draw(), the sketch will run (without any visual output).

    Considering GoToLoop got things to work, it might suggest that something up with my OS or something. Any ideas?

Sign In or Register to comment.