Simple particle simulation where the particles are all attracted to one point and don't interact with one another.
The CPU simulation is written in Odin using raylib for rendering, and the GPU simulation is written in C and GLSL, using a compute shader for particle calculations and raylib/rlgl for rendering.
CPU Sim:
- Install Odin, if not already installed
- Clone this repo
- Run
odin run cpu
GPU Sim: NOTE: The is in C instead of Odin because I had to recompile raylib's source to be able to use GLSL version 430, and Odin has raylib as part of it's vendor library so instead of going down the rabbit hole of how to recompile that I just wrote it in C.
- Install Git, GCC, Make, and CMake, and ensure sure your computer supports OpenGL 4.3 or higher
- Clone raylib,
git clone https://github.com/raysan5/raylib
cd raylib
and edit CMakeLists.txt, adding to the start of the fileset(GRAPHICS=GRAPHICS_API_OPENGL_43)
- Recompile raylib with the edited CMakeLists.txt (e.g.
mkdir build && cd build && cmake .. && make && sudo make install
)- If not installed already this tutorial details how to install raylib on any platform
- Compile and run following the tutorial mentioned above
the screenshots don't do it justice, it looks much better moving but I can't screen record on this laptop
~50 FPS on my old laptop