In this project, I created a scene of the solar systems with the planets all rotating around the sun in different orbits and moons rotating around the respective planets. Also, rings for some of the planets were also implemented in this project.
I had to create individual spheres for each of the bodies that I was creating in the system. I also had to implement moons rotating around the respective planets and also discs around some of the planets like uranus and saturn. I also had to color each of the planets separately to differentiate them from each other.
First of all, I created a function called newSphere() with arguments, the amount by which the planet was translated, the rotational axis of the planet, the color of the planet in rgb and whether or not the planet had a moon or not.
Once I had this, I then had to create a newMoon() function that took in the translation and rotation of the moon and whether or not this was the last moon for the planet or not. To create the disks around the planets, I used the gludisk function that took in an inner and an outer radius. To ensure that the color used for each sphere was different, I added the line glEnable(GL_COLOR_MATERIAL) to the initlights() function.
This was a very interesting project as I was able to create a very interesting scene using rotations and translations and I was also able to learn the fundamentals of the Open GL system through the various functions that I had to use to create the scene.