PDA

View Full Version : Drawing Polygons With The Mouse?



Astroboy
01-29-2004, 10:59 PM
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 http://www.opengl.org/discussion_boards/ubb/smile.gif

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

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

ZbuffeR
01-30-2004, 12:46 AM
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).]