# Music Visualizer in C++ Using OpenGL Part 4

We use display() function to plot the spectrum in OpenGL. This function is called each time we fetch N/2 points into the graph[].

glutSpecialFunc(special) calles the void special(int key, int x, int y) function which is used to get the input F7,F8,F9 to toggle interpolation, clamping, and show points.

We also use glutKeyboardFunc(key) to get keyboard input. You can combine the above function with this if you want. For the sake of simplicity I have used another function key() to get keyboard input.

OpenGL have a function called glutIdleFunc() which loops and doesnot effect the display() function. We are creating a new function called moveWav() to loop untill all the samples are fetched. This basically calls getData() and display().

## Compiling and running

Create a file called compile and add the following content.mylib/lib is where aquila library is build.

After compiling type ./draw <audio> to run the visualizer.

Full Source Code.