processingparallaxprojectoranaglyph-3d

Multiple render to two projectors using processing (for Polarization based 3D)


I want to setup a 3D installation in our college, for that, I want to know that, whether I can setup two eye distance separated cameras in processing, and render each one to two different projectors, so that, I can blend those outputs by polarizing them and implement 3d effect.


Solution

  • You can open a second Window in processing by creating an instance of a PApplet and adding it to a new JFrame window. The following example creates a simple sketch that opens two windows and draws a circle slightly shifted to the left in one of them and to the right in the second one. These windows can be placed on the different projectors

    import javax.swing.JFrame;
    
    PFrame f;
    
    void setup () {
      size(300,300);
      PFrame f = new PFrame();
    }
    
    void draw() {
      background(0);
      ellipse(140,150,100,100);
    }
    
    public class Second extends PApplet {
      public void setup() {
        size(300,300);
      }
    
      public void draw() {
        background(0);
        ellipse(160,150,100,100);
      }
    }
    
    public class PFrame extends JFrame {
      public PFrame() {
        setBounds(0,0,300,300);
        Second s = new Second();
        add(s);
        s.init();
        show();
      }
    }