Celestial Bodies

Celestial Bodies

Celestial Bodies is an OpenGL planetary gravity simulation written in C. This project was made as part of a university unit, Computer Graphics Principles and Programming. The task was to develop a physical simulation of our own design using C and OpenGL. This was my first encounter with graphics programming and OpenGL.

Simulation Features

  • Physically simulated gravity.
  • Elastic collision response.
  • Physically accurate orbits, rotations, and relative sizes (bar the sun which would be way too big).
  • Stop, Start, and set the speed of the simulation.
  • Enable/Disable Gravity.
  • Modify planetary mass and witness how the altered gravity field affects the system.
  • Launch small moons to knock things off course.
  • Object movement trails.
  • Intuitive click-and-drag camera movement.
  • Right-click menu functionality.

Source Code

The code has also been made available on GitHub:


See the following video for a demonstration of the features.

Back to Portfolio