Exercise: OpenGL Transformations 1(Solar System)

EX_OPENGL_TRANSFORMATIONS_SOLAR

NOTE: Create a Directory "GraphicsExercises" for all your 3DGraphics Lab work.

 

NOTE: To draw sphere use the following;

// put these two lines in the function where drawing will be performed
glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);

GLUquadricObj* obj=gluNewQuadric(); // this can be recycled to draw many objects


...


// Draw a Sphere
gluSphere(obj,  1.0,  10 , 20); // a sphere radius 1.0 on the origin


//the values 10 & 20 control how accurately the cylinder is drawn, try some other values

Part A

  1. Create a Win32 Application project in VisualC++ called EX_OPENGL_TRANSFORMATIONS_SOLAR_A. (use the "3DOpenGLStarterProject" template)
  2. Draw a large yellow wire sphere at the origin, representing the Sun.
  3. Compile and Execute.

 

Part B

  1. Modify the code in part A to all a smaller blue sphere ('Earth') a distance away from the 'sun'.
  2. Animate the scene to have the Earth orbit the sun.
  3. Compile and Execute.

Part C

  1. Modify the code in part B to have the Earth spin on its own axis.
  2. The Earth should spin 365 times for every orbit of the Sun.
  3. Compile and Execute.

Part D

  1. Modify the code in part C to add a small grey sphere ('Moon') orbiting close to the 'Earth'
  2. The Moon should spin around the Earth once for every 28 spins of the earth.
  3. Compile and Execute.

Part D

  1. Modify the code in part D to add a red sphere ('Mars') orbiting the Sun a little further out.
  2. Mars has two small moons, add these.
  3. Compile and Execute.