Hello, I am pretty new to opengl and I want to do a particle system. I have been using GLUT for everything in opengl that I did up to now. Eventually I want this particle system to be relatively big project, and working with at least hundreds of thousands of particles so I don’t know if GLUT is a good choice. Initially I was planning to do this on GPU side using GLSL but it appears a little more complex that I thought. Will the GPU increase the speed significantly or not that much? And generally what approach and what libraries do you recommend for building a good particle system?
The choice of windowing toolkit (GLUT vs GLFW vs whatever) doesn’t matter. Typically you’d use the simplest one which is flexible enough for your purposes.
Considering the particle system in isolation, the GPU will almost certainly be faster than the GPU. OTOH, as part of a system where the GPU is saturated while the CPU is idle, using the CPU will be more efficient (and vice versa). Getting the most from the GPU boils down to maximising parallelism. If the particles don’t interact, then you can just update all of the particles in parallel. If there’s some form of interaction (e.g. collision), you’d typically update all of the particles in parallel, identify interactions which invalidate the calculations, recalculate (in parallel) the cases where the initial calculations were invalid, identify interactions in the updated particles, repeat until done. Typically the set of particles requiring recalculation will shrink at each stage. I can’t think of anything which would absolutely require particles to be processed sequentially.
I don’t know of any relevant libraries.
Got it. Thanks for the answer.
In my youtube video channel on opengl tutorials, I have been slowly building and playing with a particle system that is just POINTS (Point Sprites), however, I use the Fragment shader to map either my own creation (procedural texturing) or actual textures.
Here’s one of the first videos where I explore a simple particle system using gl_pointcoord in the fragment shader:
There are a bunch of others, in fact, particle systems are of particular interest to me, so if you have a request for something you want to see me make a video of, please let me know! Hint: I will see your comments on my videos on youtube, so that’s the quickest way to get my attention.
Hope this helps,