A work in progress
November 21st, 2011

ICM – Planets

 

 

Source Code

import processing.opengl.*;

void setup()
{
 size(800, 600, OPENGL);
 smooth();

}

void draw()
{

  float earthDistance=(width/3)*2;
  float earthSize=150;

 background(0);
 lights();

 translate(width/2, height/2);

 fill(#FFFF00);
 pushMatrix();

   rotateY(radians(frameCount*2));

   translate(0,0);
   sphereDetail(30);
   sphere(125);

 popMatrix();

 //Mercury

  fill(#A9A9A9);
 pushMatrix();
   rotateY(radians(frameCount/0.24109));
   translate(0.4*earthDistance, 0);
   sphereDetail(10);
   sphere(0.055*earthSize);
 popMatrix();

 //Venus

 fill(#DAA520);
 pushMatrix();
   rotateY(radians(frameCount/0.6156));
   translate(0.7*earthDistance, 0);
   sphereDetail(10);
   sphere(0.0815*earthSize);
 popMatrix();

 //Earth

  fill(#0000FF);
 pushMatrix();
   rotateY(radians(frameCount));
   translate(earthDistance, 0);
   sphereDetail(30);
   sphere(earthSize);
 popMatrix();

 //Mars

  fill(#8B0000);
 pushMatrix();
   rotateY(radians(frameCount/1.882));
   translate(1.5*earthDistance, 0);
   sphereDetail(10);
   sphere(0.107*earthSize);
 popMatrix();

}

0 Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

This work is licensed under GPL - 2009 | Powered by Wordpress using the theme aav1