Drawing a rigid body's path through the scene?

I’ve been working on a first-person shooter game with Bullet and OpenGL, and now have it to the point of being able to fire bullets through the scene. I’m now looking to draw the path these bullets take, from starting position to their ending position, with the entire path staying drawn until the next bullet is fired (so that the screen isn’t cluttered).

I’m basically just looking for something like a red line that extends to the bullet’s new position each frame, or something like that. So, by the time the bullet has gone from the gun to its final stopping place, the red line will show the exact path it took, what it bounced off of, etc.

I’ve tried looking for examples but I can’t find anything useful. I’ve seen mention of leaving a trail behind an object using an accumulation buffer, but that’s not really what I want.

How can this be done? Does everyone know of any examples or tutorials for this?

You can draw a sequence of connected line segments with glDrawArrays(GL_LINE_STRIP). The rest is a matter of getting the positions out of the physics engine and storing them, which isn’t an OpenGL issue.

Thanks, I can’t seem to figure out how to use this properly though.

I have this:
for (i = 0; i < latestMesh; i++ {
// Render each mesh up to how many there are
// Update meshPosition[i] xyz position based off physics
points.push_back(vec3(meshPositions[lastestMesh].x, meshPositions[lastestMesh].y, meshPositions[lastestMesh].z));

Which adds the latest mesh’s position to a vector<vec3> of points. What exactly do I need to draw the line?