Double Clicking

I need to implement a line drawing program. I left click to specify the starting point and then double click to signify the end-point. How do I implement the double click in openGL?

OpenGL is a graphics library and does not handle inputs.

You have to use the windows mouse input functions, some other API like GLUT, SDL, etc.

Originally posted by razor4077:
I need to implement a line drawing program. I left click to specify the starting point and then double click to signify the end-point. How do I implement the double click in openGL?

If you are using GLUT I do not think that double clicks are directly supported. But, it should be easy to use a time function to retrieve (static variable) time count at GLUT_DOWN and when another GLUT_DOWN occurs check the difference between the previous time and current time. If less than some time you determine and if x and y (probably also static variables) are in close proximity (a few pixels) to previous x and y positions then count that as a double click. It would probably need to be included in your callback for a single click. If criteria for double click is not met then treat it as a single click.

Otherwise, double clicks are system specific if using other than GLUT or some other API or OpenGL toolkit. Also, double clicks may have been implemented in later versions of GLUT.