The OpenGL API helps us communicate with the GPU. It helps us send data (such as vertices) to the GPU effectively.

Once in the GPU, what happens to the data? How is it processed?

Once data is in the GPU, the OpenGL pipeline takes each vertex through a series of stages. It begins with the Vertex Processing Stage and ends with the Fragment Processing Stage. These stages set the right vertex coordinate and provide a color for each pixel, respectively.

In both stages, you have total control over the destiny of the vertices and fragments. You can manipulate their coordinate system as well as change the color of a pixel in a fragment.

OpenGL gives you so much control over the vertices and fragments that it created its own GPU language. It is called OpenGL Shading Language (GLSL).

Unlike any other language, GLSL only operates in the GPU.

Thus, what is the purpose of the OpenGL API?

Its purpose is to take data from the CPU to the GPU and hand off this data to the OpenGL Pipeline where it goes through a series of processing stages before it is sent to the display framebuffer.