Texture a Circle for my solar system!

Having trouble getting correct texture loading.

PImage IMG;
PShape SHP;


int numDetail = 360;
float rot = TWO_PI/numDetail;

void setup() {
  size(400, 400, P3D);
  IMG = loadImage("earth.jpg");
  smooth();
}

void draw() {
  background(255);
  translate(width/2, height/2);
  float radCircle = 200;
  beginShape();
  texture(IMG);
  for (int i=0; i<numDetail; i++) {
    float angle = i*rot;
    float x = cos(angle);
    float y = sin(angle);
    vertex(x*radCircle, y*radCircle, x*radCircle, y*radCircle);
  }
  endShape(CLOSE);
}

earth

Sign In or Register to comment.