My application has a split screen mode where just half of the screen is used to display the 3d scene. So I want the vanishing point to be placed in the middle of the left half.
I already tried various combinations of camera()
and translate()
but the vanishing point doesn't move one pixel from the center of the sketch window..
void setup(){
size(800,400, P3D);
fill(255,120);
}
void draw(){
background(111);
float camEyeX = 0;
float camEyeY = 400;
float camEyeZ = (height/2) / tan(PI/6);
float camCenterX = 0;
float camCenterY = -200;
float camCenterZ = 0;
float camUpX = 0;
float camUpY = 1;
float camUpZ = 0;
pushMatrix();
camera( camEyeX, camEyeY, camEyeZ, camCenterX, camCenterY, camCenterZ, camUpX, camUpY, camUpZ );
translate( -200, 0, 0);
rectMode(CENTER);
rect(0,0, 800,400);
rect(0,0, 100,100);
popMatrix();
hint(DISABLE_DEPTH_TEST);
rectMode(CORNER);
rect(400,0, 400,400);
hint(ENABLE_DEPTH_TEST);
}
On this topic I just found this unanswered question asked a decade ago... Does anyone know if this is possible to achieve at all?
You could just use the
createGraphics()
function to create a buffer for your left viewport, then draw to the buffer, then draw the buffer to the screen.More info can be found in the reference.