Last Updated
January 10, 2011
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
- Create a Win32 Application project in VisualC++ called EX_OPENGL_TRANSFORMATIONS_SOLAR_A.
(use the "3DOpenGLStarterProject"
template)
- Draw a large yellow wire sphere at the origin, representing the Sun.
- Compile and Execute.
Part B
- Modify the code in part A to all a smaller blue sphere ('Earth') a distance
away from the 'sun'.
- Animate the scene to have the Earth orbit the sun.
- Compile and Execute.
Part C
- Modify the code in part B to have the Earth spin on its own axis.
- The Earth should spin 365 times for every orbit of the Sun.
- Compile and Execute.
Part D
- Modify the code in part C to add a small grey sphere ('Moon') orbiting close
to the 'Earth'
- The Moon should spin around the Earth once for every 28 spins of the earth.
- Compile and Execute.
Part D
- Modify the code in part D to add a red sphere ('Mars') orbiting the Sun
a little further out.
- Mars has two small moons, add these.
- Compile and Execute.
© Ken Power 1996-2016