var img;
function preload() {
  img = loadImage("draven.jpg");
}
function setup(){
  createCanvas(710, 400, WEBGL);
}

function draw(){
  background(0);

  var locY = (mouseY / height - 0.5) * (-2);
  var locX = (mouseX / width - 0.5) * 2;

  ambientLight(100, 80, 80);
  pointLight(200, 200, 200, locX, locY, 0);

  push();
  rotateZ(frameCount * 0.02);
  rotateX(frameCount * 0.02);
  rotateY(frameCount * 0.02);
  texture(img);
  box(80);
  pop();
}

We have put a 3D object with the function preload that what it does is load the image before all that is why we put it before the setup.We also put the webgl so that this function is possible.We create a variable with the image and tell it to put it in the cube.