let img;

function preload() {
  img = loadImage('https://upload.wikimedia.org/wikipedia/commons/thumb/7/75/Image_skin_texture.jpg/1599px-Image_skin_texture.jpg');
  img2 = loadImage('https://upload.wikimedia.org/wikipedia/commons/thumb/6/64/Oyster_shells%2C_texture%2C_Esnandes%2C_Charente-Maritime%2C_august_2015.jpg/1599px-Oyster_shells%2C_texture%2C_Esnandes%2C_Charente-Maritime%2C_august_2015.jpg');
}

function setup() {
  createCanvas(500, 500, WEBGL);
}

function draw() {
  ambientLight(250);
  let dirX = (mouseX / width - 0.5) * 2;
  let dirY = (mouseY / height - 0.5) * 2;
  directionalLight(250, 250, 250, -dirX, -dirY, 0.25);
  background(0);
  rotateZ(frameCount * 0.001);
  rotateX(frameCount * 0.001);
  rotateY(frameCount * 0.001);
  //pass image as texture
  //texture(img);
  //box(500, 500, 500);
  texture(img);
  sphere(1200);
  push();



  translate(240, 0, 0);
  push();
  rotateZ(frameCount * 0.01);
  rotateX(frameCount * 0.01);
  rotateY(frameCount * 0.01);
  texture(img);
  torus(120, 110);
  pop();

  translate(0, -250, -260);
  push();
  rotateZ(frameCount * 0.01);
  rotateX(frameCount * 0.01);
  rotateY(frameCount * 0.01);
  texture(img);
  torus(20, 80);
  pop();

  translate(0, -200, -200);
  push();
  rotateZ(frameCount * 0.02);
  rotateX(frameCount * 0.02);
  rotateY(frameCount * 0.02);
  texture(img);
  torus(60, 190);
  pop();

  noStroke();
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.8.0/p5.min.js