$40
Goal
➢ Draw three solid sphere: Sun, Earth, Moon.
The Earth should have spin axis, like the picture.
(You can use gluCylinder(….) function to draw the axis.)
➢
The Sun is located in the center with the Earth rotates around it, and the Moon rotates around the Earth.
➢ When pressing the key “P”, all the planets should stop moving. When pressing the key “O”, the Earth should switch the slice and stack number.
*You can use any mode to draw the planets
(ex. GL_TRIANGLES, GL_TRIANGLE_STRIP, GL_QUADS) But if you use glutsolidsphere(), you can’t get the score of this part.
*You should use glPushMatrix() and glPopMatrix() to implement the rotation and revolution of the planets.
Spec
Global value:
Degree: X(any value) Radius: Y(any value)
Camera:
Position: (0, 30, 50)
Center: (0, 0, 0)
Up vector: (0, 1, 0)
Light:
Position: (0, 10, 0)
Diffuse: (1, 1, 1, 1)
Ambient: (0.5, 0.5, 0.5, 1)
Keyboard:
“P”: Pause the planets
“O”: Switch the slice and stack number of the Earth
Spec
Sun: Earth:
Position: (0, 0, 0) Slice: 360 Slice: 4
Slice: 240 Stack: 180 Stack: 2
Stack: 60 <Switch when pressing key “O”
Rotation: 0
Radius: 7*Y Rotation: X
Diffuse material: any Revolution: X/365 Radius: 2*Y
Obliquity: 23.5
Length of rotation axis: 4*Y
Revolution radius(around sun): 18
Diffuse material: any
Moon:
Slice: 240
Stack: 60
Rotation: X/28
Revolution: X/28
Radius: Y
Revolution radius(around earth): 3
Diffuse material: any
Score
1. Draw the solid planets (20%)
If you use glutsolidsphere(), you can’t get the score of this part.
2. Implement the rotation(自轉) and revolution(公轉) (65%)
3. Report (15%)
Your report should include:
(1). (Briefly) Explain the whole program’s structure.
(2). (Detailed) How do you implement the revolution and rotation by glPushMatrix() and glPopMatrix()?
(3). (Detailed) How do you draw the planets?( If you don’t use glutsolidsphere() )
Others
1. Use Visual Studio 2017 or 2019 for this homework.
2. You can do this homework in the “StudentID_HW1.cpp” file because we had prepared basic framework for you. Remember to rename this cpp file with your own student ID.
3. Zip your Visual Studio project into “ StudentID_HW1.zip”, and name your report “StudentID_HW1.pdf”. Then upload both of them separately to New e3.
4. The deadline is at 11:55 pm on Octobor 14.
5. If you submit your homework late, the score will be discounted.
submit between (10/15 ̴ 10/21) : Your final score * 0.9 submit between (10/22 ̴ 10/28) : Your final score * 0.8 submit after 10/29 : Your final score * 0.7
Result for pressing key ”O”