How can I draw several lines one by one

For example, I want to draw three lines,
but want to show the progress of drawing the lines: draw one line, after one second, draw another line.

That’s, how can I show the progress instead of giving three lines right away.

Thanks for all your helps.

Depending on how smooth/sophisticated the animation the answer changes. Simplest method

keeps track of the current line.
You increment the counter
Draw lines from 0 to counter.

You would probably increment the counter
in a timer function or thread, so you could set some animation detail.

Thanks, you method is a good methed.
Actually, my graphic is not so simple, I can not keep track of them.
Is there anyway that, I draw part of the picture, show it, then hold for a second, then draw the another part of the picture.

I use something like Idle and sleep, but it did not show anything untill the whole picture is drawn.

Maybe I did not use the idle method correctly, any place I can find sample codes?

Thanks a lot!

It is not possible to see partial result with opengl. However, you can define a clip plane.
In case you do not know, for any clip plane, only primitives on the positive side of the clip plane, ie pos*normal of clip plane > 0,
is drawn, the rest is clipped. You can then “animate”, ie move the clip plane across space, as you render. This will allow you too slowly show the scene being draw, but actually each time it is being rendered, but a larger and larger piece of it is not being clipped.

You can define clip plane as follows:

glClipPlane( id, clipplane_eq);
where equation is just the equation of a plane.

Remember clip plane is modifed by the modelview, so be careful.