I’d like to draw a ‘dynamic’ trajectory graph in OpenGL. More specifically: I’d like to plot a trajectory (whether in 2D or in 3D). The trajectory results from an integration of some equations of motion. Here is what I want:
- plot the trajectory during the integration (ie assemble the trajectory by plotting a line between the two current values in the integration because I don’t want to store the data).
- have the possibility to change automatically some parameters (through an optimization algorithm for instance) and plot the new trajectory. To explain it differently, I want to see the trajectory ‘evolving’ as I’m changing the parameters.
My problem is that I cannot manage to do it… What I see in the Opengl window is just the last segment of the trajectory, the others don’t show up. What I’m doing is that I’m having global variables that tell me where my previous and current trajectory points are, and my display callback function is drawing a line joining those 2 points.
Does somebody have an idea on how to do this properly ? Thanks a lot in advance !