The geometric primitive types supported by OpenGL are points, lines, linestrips, line loops, polygons, quads, quad strips, triangles, triangle strips, and triangle fans. In this example, we drew two triangles, where each of the shapes is provided with a set of vertices and colors so that OpenGL knows how the shapes should be rendered.
The rainbow color effect is created by giving a different color to each of the vertices. OpenGL will automatically interpolate the colors between each vertex and display it on screen. Currently, the shape that gets rendered first will appear at the back of other shapes that get rendered later. This is because we are rendering the shapes in a 2D space and no depth information is involved to check which shape is located at the front and so on. We will learn how to do depth checking in the following example.