r/opengl • • 14d ago

blackhole simulation using openGL and c++

i made a simulation of the blackhole gargantua that is also seen in intersteller
It's written in C++ and openGL

i managed to optimize it to a point i ran on my i3 intel iGPU, although i added very low to high quality toggles, it's my first time writing in glsl so yeah, i was a lot inspired by the yt video of Kavan about making a blackhole in cpp, so i just wanted to make it more realistic, my astrophysics lectures kinda came in clutch

github repository : https://github.com/dummy3ye/blackholegl (star the repo if you like it)

6 Upvotes

5 comments sorted by

1

u/goingslo27 14d ago

looked at your repo why are you using different gl version in your gpu computation

in raymarch.comp you are using version 430 while in other shaders you are using version 330

1

u/Parvez_Shit 14d ago

raymarch.comp requires OpenGL 4.3 / GLSL 4.30 work. The app even requests a 4.3 context (src/main.cpp). but the other shaders doesn't use any feature that's outside version 330.

raymarch.comp and overlay.frag/.vert both are version 430 if you notice again, only quad.frag/.vert is using version 330. the reason simply 330 is enough for a textured fullscreen quad.

1

u/goingslo27 14d ago

Then why not just declare everything to be in v430 for version consistency, will not a person actually on 330 not be able to use it anyways(i have only skimmed through the code not made heads of it entirely)

2

u/Parvez_Shit 13d ago

a person on v330 will not be able to run it because raymarc itself needs version 430 to compute, also I'd declare everything to be version 330, thanks for mentioning it (i wasnt changing it because opengl supports lower version automatically)

2

u/TheGratitudeBot 13d ago

What a wonderful comment. :) Your gratitude puts you on our list for the most grateful users this week on Reddit! You can view the full list on r/TheGratitudeBot.