How it works...
GLUT is initialized and a top-level window is created with the label, Animating a ball. The initial position of the window is set at 0,0, that is, at x=0 and y=0 coordinate location. The window size is specified with 1,000 px of width and 1,000 px of height. The callback function, animball, is invoked to display a bouncing ball.
In the animball callback function, the values of the color buffers are cleared. The color for drawing the bouncing ball is set to green. Because the ball will be drawn using small points or dots, the glPointSize is set to 1 px.
The GL_PROJECTION is set as the current matrix in order to enable parallel and perspective projections. Also, a two-dimensional orthographic viewing region is set up, defining ...
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