Hi All
I wonder if someone could help?
I wanted to map a jpg texture onto a version I have made of Ira Greenbergs flapping bird sketch (the one in the Processing examples).
I don't seem to be able to do it! Here is the code, can anyone help? I wanted to put a texture onto the box, another texture onto the larger sphere, and a texture on the bezier wings. I will make the two small sphere eyes a single colour.
Thanks! 
Quote:/**
 * 3D Moth Creature
 * by Will Pearson, grateful thanks to orignal sketch by Ira Greenberg.
 */
PImage img;
float ang = 0, ang2 = 0, ang4 = 0;
float pz = 0;
float flapSpeed = 0.25;
float boxX = 20;
float boxY = 80;
float boxZ = 30;
void setup(){
  size(640, 360, P3D);
  img = loadImage("mothbody.jpg");
  noStroke();
}
void draw(){
  background(0);
  lights();
  // Flight
 
  pz = sin(radians(ang4)) * 500;
  translate(mouseX, mouseY, -500+pz);
  rotateX(sin(radians(ang2)) * 120);
  rotateY(sin(radians(ang2)) * 50);
  rotateZ(sin(radians(ang2)) * 65);
  
  // Body
  beginShape();
  
   box(boxX, boxY, boxZ);
   endShape();
  // Left wing
  fill(204);
  pushMatrix();
  rotateY(sin(radians(ang)) * -20);
  beginShape();
  texture(img);
  bezier(boxX-20, boxY-20, boxZ-20, 80, -90, -75, -10, 60, -75, 100, 50, -20);
  endShape();
  
  //rect(-75, -50, 75, 100);
  popMatrix();
  // Right wing
  pushMatrix();
  rotateY(sin(radians(ang)) * 20);
  beginShape();
  texture(img);
  bezier(boxX-20, boxY-20, boxZ-20, 80, -90, 75, -10, 60, 75, 100, 50, 20);
  endShape();
  popMatrix();
  
  //head
  pushMatrix();
  translate(boxX-20, boxY-20, 0);
  sphere(22);
  popMatrix();
  
  //eyes
  pushMatrix();
  translate(boxX-20, boxY-2, 8);
  sphere(8);
  popMatrix();
  
  pushMatrix();
  translate(boxX-20, boxY-2, -8);
  sphere(8);
  popMatrix();
  
  // Wing flap
  ang += flapSpeed;
  if (ang > 3) {
    flapSpeed *= -1;
  } 
  if (ang < -3) {
    flapSpeed *= -1;
  }
  // Increment angles
  ang2 += 0.01;
  ang4 += 0.75;
}