Error using P3D on Raspberry Pi

Been creating several 3D sketches successfully on my Windows machine, now trying to get them to run on a new Raspberry Pi 3B+ that I bought. Whenever I try to run a script I immediately get a segmentation error. Based on my research I believe its an issue with OpenGL but I don’t know how to possibly fix it.

For example, this simple code:
void setup() {
size(640,360,P3D);
}
void draw() {
}

Gives error SIGSEGV Problematic Frame libjvm.so PhaseIdealLoop::build_loop_Late_post_work. Could not run the sketch (Target VM failed to initialize).

Running Processing 4.1.1 and on OS Raspbian GNU/Linux 11 (bullseye). Also please go easy on my with the Linux talk, this is my first experience using it, been strictly Windows before now. Thanks!

I’m on a PI 4+ and64-bit OS.

pi@raspberrypi ~ $ uname -a
Linux raspberrypi 5.15.76-v8+ #1597 SMP PREEMPT Fri Nov 4 12:16:41 GMT 2022 aarch64 GNU/Linux

and Processing 4.0.1

and I have no problems wit P3D.
So maybe, 4.1.1 is broken? Roll back to 4.0.1. You find it here

Search for 4.01 and then open Assets to download your version.

Here some sample code

float x,y,z; 

void setup() { 
 size(800,600, P3D);
 noStroke();
 fill(204);
 rectMode(CENTER);
 fill(51);
 stroke(255);
}

void draw() {
    background(0);
    lights();
    camera(width/2, height/2, (height/2) / tan(PI/6), width/2, height/2, 0,0,1,0);
    float ZZ = PI/100*z++;
    pushMatrix();
    translate(width/2, height/2, 0);
    rotateX(PI/8+ZZ/10); 
    rotateY(PI/3+ZZ/25); 
   
    pushMatrix();
 //   rotateX(PI/8); 
 //   rotateY(PI/8); 
    rotateZ(-PI); 
    stroke(255, 255, 255);
    fill(0,0,255,32);
    box(95,95,95);
 //   rect(0,0,100,100); 
    popMatrix();
    pushMatrix();
//   translate(100, 100, 0);
   rotateX(-PI/8); 
  //  rotateY(-PI/8); 
    rotateY(-ZZ/2+PI/3); 
    fill(255,0,0,32);
    stroke(255, 0, 0);
    box(100,100,100);
  
    popMatrix();
    translate(100, 100, 0);
     pushMatrix();
 //   rotateX(-PI/8); 
    //rotateY(-PI/8); 
    rotateY(-ZZ*.2); 
     rotateZ(-ZZ*.3); 
    fill(0,255,0,32);
    stroke(0, 255, 0);
    box(105,105,105);
    translate(100, 100, 0);
    popMatrix();
    fill(0,255,0,0);
    stroke(255, 255, 255);
    box(105,105,105); 
    popMatrix();   
}    

and the result