PImage img;
PShape sphere;
PShape box;
void setup() {
size(600, 600, P3D);
img = loadImage("world32k.jpg");
sphere = createShape(SPHERE, 100);
sphere.setTexture(img);
sphere.setStrokeWeight(0);
box = createShape(BOX, 100);
box.setTexture(img);
box.setStrokeWeight(0);
}
void draw(){
background(0);
pushMatrix();
translate(width/3, height/2, 100);
rotateX(map(mouseY, 0, width, -PI, PI));
rotateY(map(mouseX, 0, width, -PI, PI));
shape(sphere);
popMatrix();
pushMatrix();
translate(width/3 * 2, height/2, 100);
rotateX(map(mouseY, 0, width, -PI, PI));
rotateY(map(mouseX, 0, width, -PI, PI));
shape(box);
popMatrix();
}
Hello,
This is the same as this:
ProcessingでSphereやBoxのPShapeを取得 - Qiita
My understanding is gallery is to “Share and discuss your work”:
The image is here:
processing-docs/content/examples/Topics/Textures/TextureSphere/data at master · processing/processing-docs · GitHub