Drawing Polygons With The Mouse?

Does anyone know how to draw a growing polygon with the mouse? Basically I want the first edge to be drawn like a line, click once to set the first endpoint, release to set second endpoint. Then each time the mouse is clicked again, another vertex is set. On double click, it should signal the final vertex.

My plan was to create a vector and store all the vertices and essentially draw lines with GL_LINES. But I can’t get past drawing the first line.

Has anyone done this before, maybe shed some light on the issue?

Thanks

[This message has been edited by Astroboy (edited 01-30-2004).]

[This message has been edited by Astroboy (edited 01-30-2004).]

It should work as you described it.

If not, it is likely to be a bug in your code. It may help to post relevant parts.

Edit: Use GL_LINE_STRIP instead, read the differences in the documentation. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/opengl/glfunc01_9u3y.asp

[This message has been edited by ZbuffeR (edited 01-30-2004).]