The following are the steps for drawing a bar chart with the values defined in an array:
- Initialize GLUT, define the size of the top-level window, set its initial position for display, and display the window on the screen.
- Define the callback function that is auto-invoked after creating a window for drawing the bar chart.
- An array is defined in the callback that defines the height of the bar chart. The width of the bar chart is fixed at 2 px.
- A two-dimensional orthographic viewing region is set up, that is, coordinates are set up for horizontal and vertical clipping planes.
- To display the horizontal and vertical x and y axes, the vertices for the two lines are grouped in a glBegin and glEnd pair with the GL_LINES keyword. ...