Reputation: 507
I want to start a basic particle system in C++ using OpenGL. I wrote an algorithm for that but I don't understand how to start it.
The problem I am facing is I can print the positions and velocity updates but I don't know how to show it visually using OpenGL.
Upvotes: 1
Views: 2234
Reputation: 44444
I hope you are trying out something on the lines of what is below:
Have a structure(C++ struct or a class) to denote a Particle. The structure contains:
Have an array of this structure. Initialise velocity, position, and acceleration as needed.
In a separate thread (or in the repaint event, for starting up) do the following:
For every particle (element in the array) do:
particle[index].velocityZ += particle[index].accelerationZ
particle[index].locationX += particle[index].velocityX
//translate to the location and paint..
Upvotes: 4