Skip to content
sanketsriv22Public

About

OpenGL N-Body 2D simulation of gravity in C++. Utilizing Newton's Laws of Universal Gravitation.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

35 Commits

Folders and files

Repository files navigation

Gravity Sim (C++, OpenGL)

A Gravity Simulation created with OpenGL.

GIF


Features


Getting Started

Prerequisites

  • C++ compiler ('clang++' or 'g++')
  • glfw (installed via Homebrew on macOS):
brew install glfw

Clone the Repo

git clone https://github.com/sanketsriv22/gravity.git
cd gravity

Build and Run

If using VSCode, just run build task (Cmd + Shift + B)

g++ -std=c++20 -I/opt/homebrew/Cellar/glfw/3.4/include \
    -L/opt/homebrew/Cellar/glfw/3.4/lib \
    -lglfw *.cpp -o Gravity
./Gravity

Or if you prefer cmake (I've added my CMakeList.txt)

brew install cmake

Create a cmake build in the repo

cmake -S . -B build

Compile/Build (Cmd + Shift + B) And run

./build/gravity

Controls

Future Improvements

About

OpenGL N-Body 2D simulation of gravity in C++. Utilizing Newton's Laws of Universal Gravitation.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages