We are about to switch to a new forum software. Until then we have removed the registration on this forum.
So I managed to get the multiple viewport working, or almost…
Now I narrow down my problem to aha,t seams to me, the default viewport being seen. Easy to understand running the snippet.
The real scenario is a canvas with 2160 x 640, containing 6 viewports 213 x 640 each.
So I set my camera aspect ratio to 213 X 640 and stuff inside the viewport is fine no distortion. But… Even with only one vp I still seeing the "default" render, and this one is badly distorted.
Can I tur this one off?
Please ask if it's unclear.
thanks
float margin = 73.5;
float dMargin = margin * 2;
float rectW = 213;
float rectH = 640;
PVector[] coord = new PVector [7] ;
float x, y, speed = -0.1;
float a, r = 150;
Part[] parts = new Part[1000];
float mx = -200, my, tmx, tmy;
PGL gl;
float m = 6; 
void setup() {
  sphereDetail(10);
  size(1000, 640, P3D);
  noStroke();
  PGraphicsOpenGL pgl = (PGraphicsOpenGL) g; 
  gl = pgl.beginPGL();
  for (float i = 0, x = margin; i < 7; i++, x+= (rectW+dMargin )) {
    coord[int(i)] = (new PVector(x, 0));
  }
  for (int i = 0; i < parts.length; i++) {
    parts[i] = new Part();
  }
}
void draw() {
  lights();
  frame.setTitle(nf(frameRate, 3, 2));
  background(0);
  perspective(PI/1.96, (float) 214/640, 100, 5000);
  camera(0, 0, 2152, -238, -9, -1141, 0, 1, 0);
  renderP();
  gl.viewport (int(coord[0].x), int(0), int(rectW), int(rectH));
}
void renderP() {
  for (Part p : parts) {
    p.display();
  }
}
class Part {
  // angle1, angle 2, radius, speed1, speed2
  float a1, a2, r, sp1, sp2;
  PVector pos;
  color c;
  Part() {
    // random init
    c   = color(255);
    a1  = radians(random(360));
    a2  = radians(random(360));
    sp1 = random(-0.001, 0.001);
    sp2 = random( -0.001, 0.001);
    // hard number for now..
    r = 600;
    //get spherical coordinates
    pos = getSpherical(a1, a2, r);
  }
  void display() {
    noStroke();
    update();
    pushMatrix();
    translate(pos.x, pos.y, pos.z);
    fill(c);
    sphere(20);
    popMatrix();
  }
  void update() {
    pos = getSpherical(a1+=sp1, a2+=sp2, r);
  }
  // spherical coordinates
  PVector getSpherical(float ang1, float ang2, float rad) {
    PVector result = new PVector();
    result.x = rad * sin(ang1) * cos (ang2);
    result.y = rad * sin(ang1) * sin (ang2);
    result.z = rad * cos(ang1);
    return result;
  }
}