How it works...
GLUT is initialized and a top-level window is created with the label, Displaying lines between two mouse clicks. The window size is specified as 1,000 px wide and 1,000 px in height. The drawLine callback function is invoked for drawing lines if any mouse click event has occurred.
In the drawLine function, the clear values for the clear buffers are specified. Also, the buffers are cleared to preset values so that colors can be applied to them. Because no mouse click has occurred yet, the value of noOfClicks global variable is 0, and hence no line will be drawn at the moment.
The glutSwapBuffers() function is invoked to swap the front and back buffers to display any frame that is rendered in the back buffer and is ready to ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access