I am trying to understand shape() and its two parameters. In this simple example below I have used createShape() to make two spheres. Spheres, in my world, are three-dimensional. All is fine until I get to position the spheres. Here I have only two parameters (x,y):
shape(globe, 0, 0); // two parameters?
Also, the second sphere seems to be a child of the first???
I know how to use
translate(x, y, z);
sphere(radius);
But I would like to understand shape.
PShape globe;
PShape blob;
void setup() {
size (300, 300, P3D);
globe = createShape(SPHERE, 100);
blob = createShape(SPHERE, 30);
globe.setStroke(false);
blob.setStroke(false);
//
globe.setFill(color(255, 0, 0));
blob.setFill(color(255));
}
void draw() {
background(0);
translate(width/2, height/2);
rotateX(map(mouseX, 0, width, 0, TAU));
rotateY(map(mouseY, 0, height, 0, TAU));
shape(globe, 0, 0); // two parameters?
shape(blob, 100, 0); // this is, strangely, relative to the globe
}