I am having troubles drawing in 3D in AndroidStudio. This is my code in processing:
import toxi.geom.*;
import toxi.geom.mesh.*;
import toxi.math.waves.*;
import toxi.processing.*;
import processing.serial.*;
ToxiclibsSupport gfx;
void setup() {
  size(600,600,P3D);
  gfx=new ToxiclibsSupport(this);
  
  background(255);
  noStroke();
  fill(200,200,200);
}
void draw() {
  
  Quaternion RotQ = new Quaternion(1,0,0,0);
  float qMatrix[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
  PMatrix M1 = getMatrix();
  
  RotQ = new Quaternion(0.7, 0.5, 0.4,0.316227766);
  
  RotQ.toMatrix4x4().toFloatArray(qMatrix);
  
  M1.set(
      qMatrix[0], 
      qMatrix[1], 
      qMatrix[2], 
      qMatrix[3], 
      qMatrix[4], 
      qMatrix[5], 
      qMatrix[6], 
      qMatrix[7], 
      qMatrix[8], 
      qMatrix[9], 
      qMatrix[10], 
      qMatrix[11], 
      qMatrix[12], 
      qMatrix[13], 
      qMatrix[14], 
      qMatrix[15]
      );
      
      AABB cube;
      
      background(255);
      // Set some mood lighting
      ambientLight(128, 128, 128);
      directionalLight(128, 128, 128, 0, 0, 1);
      lightFalloff(1, 0, 0);
      lightSpecular(0, 0, 0);
      // Get to the middle of the screen
      translate(width/2,height/2,0);
      // Do some rotates to get oriented "behind" the device
      rotateX(-PI/2);
      // Apply the Matrix that we generated from our IMU Quaternion
      applyMatrix(M1);
      
      //elk vlak ander kleur       
      directionalLight(0, 128, 255, 0, -1, 0); 
      directionalLight(204, 0, 0, 0, 1, 0); 
      directionalLight(0, 0, 0, -1, 0, 0); 
      directionalLight(255, 255, 0, 1, 0, 0); 
      directionalLight(255, 128, 0, 0, 0, -1);
      directionalLight(0, 255, 0, 0, 0, 1);
      // Draw the Cube from a 3D Bounding Box
      cube=new AABB(new Vec3D(0,0,0),new Vec3D(100,100,100));
      gfx.box(cube);
      
      //sphere(100);
      
      
}
When I convert this code to AndroidStudio, somehow ‘size(600,600,P3D);’ disappears. When running my code, my figure is just 2D instead of 3D. I think this is because this size(600,600,P3D); isn’t there, but when I add this line I get a null pointer error and my app crashes.
How can I display my 3D figure as a 3D figure in AndroidStudio?