float cameraDistance = 200.0;
float newCamXCoord = cameraDistance*cos(PI/4);
float newCamYCoord = cameraDistance*cos(PI/4);
float newCamZCoord = cameraDistance*cos(PI/4);
float xTop = 0;
float yTop = 0;
float zTop = -1;
void draw3DAxes(float minValue, float maxValue) {
// Draws lines along the x,y and z axes.
stroke(255,255,255);
float minAxValue = minValue - .10*(maxValue - minValue);
float maxAxValue = maxValue + .10*(maxValue - minValue);
line(minAxValue,0,0,maxAxValue,0,0);
line(0,minAxValue,0,0,maxAxValue,0);
line(0,0,minAxValue,0,0,maxAxValue);
}
//import processing.opengl.*;
public String sketchRenderer() {
return A3D;
}
void setup() {
//size(800,480,OPENGL);
orientation(LANDSCAPE);
background(0);
}
void draw() {
background(0);
camera(newCamXCoord,newCamYCoord,newCamZCoord,0,0,0,xTop,yTop,zTop);
draw3DAxes(-100,100);
}
On the desktop, this draws a set of 3d Axes (as seen from somewhere on the intersection of the planes x=y, y=z and x=z) that are centered in the screen while on my android phone (which has a resolution of 800x480) it draws these axes in the upper left hand corner. It would appear that the problem is that camera() doesn't operate the same on the device as it does on the desktop.