In this recipe, we will learn to draw a line between two mouse clicks. A mouse click is considered a procedure of pressing the mouse button and releasing it. You can draw as many lines as you want between a pair of mouse press and release events.
The following are the steps to draw a line between two mouse clicks:
- Initialize GLUT, define the size of the top-level window, and display the window.
- Define a drawLine callback function that draws a line if any mouse click event occurs.
- In the drawLine function, the clear values for the clear buffers are specified.
- The glutSwapBuffers() function is invoked to swap the front and back buffers to display any frame...