Fatal JRE Error when using two windows and createGraphics with P3D

Hi everyone,

I am having some trouble while trying to use a second window and a P3D Offscreen Texture. What I am basically trying to accomplish: Multiple Windows because of multiple projectors I am going to use in my project. I need to have 4-Point-Keystone Correction and Edge-Blending to align my projections properly. I was planning to use the keystone library and a shader for the edge-blending. This all works in a single processing window but i figured it would be necessary to have to windows because of the two desktops i will be going to have because of the projectors (and as far as I remember spanning the sketch over two desktop is not possible anymore in windows 7 and was also not really recommend before due to some OpenGL restrictions.. please correct me if I am wrong)

I am currently still testing all this stuff on my Mac but will be switching to Windows for the project.

Here's my rather simple code (without the blending and keystone stuff) that should create the two windows and just display the created PGraphics. Works fine with JAVA2D but I will need P3D..

So can you help me with the code I already have or suggest any other solution? As the target machine is a windows computer I won't be able to use Syphon and I don't think I can use Wyphon with processing yet..

(Using my own mac would be a backup plan as it is a One Night Event but I would prefer to not be forced to that solution)

import java.awt.Frame;

PGraphics pg, pg2;
secondApplet s;
PFrame f;


void setup() {
  size(640, 480, P3D);
  background(0);

  frame.setLocation(0, 0);
  f = new PFrame();

  pg  = createGraphics(640, 480, P3D);  
  pg2  = createGraphics(640, 480, P3D);
} 

void draw() {
  frame.setTitle("fps: "+frameRate);
  pg.beginDraw();
  pg.fill(255, 0, 0);
  pg.rect(mouseX, mouseY, 50, 50);
  pg.line(mouseX, mouseY, pmouseX, pmouseY);
  pg.endDraw();

  image(pg, 0, 0);
}

public class PFrame extends Frame {
  public PFrame() {
    setBounds(0, 0, 640, 480);
    s = new secondApplet();
    add(s);
    removeNotify(); 
    setUndecorated(false);   
    setResizable(false);
    addNotify(); 
    setLocation(0, 0);
    s.init();
    //show();
    setVisible(true);
  }
}

public void init() {
  frame.removeNotify(); 
  frame.setUndecorated(false);   
  frame.setResizable(false);
  frame.addNotify(); 
  super.init();
}

public class secondApplet extends PApplet {

  public void setup() {
    size(640, 480);
    background(0);
  }

  synchronized public void draw() {
    if (pg2 != null) {
      // Copy
      pg2.beginDraw();
      pg2.copy(pg, 0, 0, pg.width, pg.height, 0, 0, pg2.width, pg2.height);
      pg2.endDraw();
      image(pg2, 0, 0);
    }
  }
}

The error is rather short: Processing just says "Could not run sketch" and the console displays the following:

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

SIGSEGV (0xb) at pc=0x00007fff8b82ca07, pid=20210, tid=59399

JRE version: Java(TM) SE Runtime Environment (7.0_55-b13) (build 1.7.0_55-b13)
Java VM: Java HotSpot(TM) 64-Bit Server VM (24.55-b03 mixed mode bsd-amd64 compressed oops)
Problematic frame:
C  [libGL.dylib+0x1a07]  glGetError+0xd

Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again

Answers

  • AFAIK, Processing either slows to a crawl or crashes outright if more than 1 OpenGL-based renderer PApplet is created for the same sketch! :-SS
    Therefore we can have various JAVA2D Frame windows, but only 1 of either P2D or P3D! :-&

    Anyways, take a look at these 2 links for extra PApplet instantiation tips: (*)

  • mh okay thanks for the quick answer. So what would be the solution to my Problem then? Any way to draw everything in the P3D renderer and then just hand the visible output to the frames (where I basically just display output of the two sides of the main sketch) … then I can do the Transformations and the blending there and just have the 2 frames as separate viewports for the two desktops...

  • Any way to draw everything in the P3D renderer and then just hand the visible output to the frames

    In Processing 2, a Frame oughta be using an OpenGL renderer in order to display OpenGL PGraphics too!

    Since you apparently need more than 1 OpenGL renderer for the same app, so far, I only see 2 "solutions":

    1. Use Processing v1.5.1, whose P3D renderer is software based! Only its OPENGL renderer is hardware's.
    2. Split your app into 2 sketches. And do some sorta communication between them. Mebe OSC?
  • Okay thank's allot for your help so far. There will be a lot going on in screen so syncing everything could perhaps be quite tedious. But let's see what I can do. If I would be able to use a Mac with Syphon, what would be the best choice to do the mapping I want to do? Any advise?

  • Sorry, not knowledgeable w/ 3rd-party libraries. Suggestions above are library agnostic though! =:)

Sign In or Register to comment.