This tutorial is very short. We simply expand the previous tutorial to render a triangle.
In this tutorial we rely on the normalized box again. Visible vertices must be inside the box so that viewport transformation will map them to the visible coordinates of the window. When looking down the negative Z axis this box looks like that:
Point (-1.0, -1.0) is mapped to the bottom left hand of the window, (-1.0, 1.0) is the upper left and so on. If you extend the position of one of the vertices below outside this box the triangle will be clipped and you will only see a part of it.
Vertices = Vector3f(-1.0f, -1.0f, 0.0f);
Vertices = Vector3f(1.0f, -1.0f, 0.0f);
Vertices = Vector3f(0.0f, 1.0f, 0.0f);
We extended the array to contain three vertices.
glDrawArrays(GL_TRIANGLES, 0, 3);
Two changes were made to the drawing function: we draw triangles instead of points and we draw 3 vertices instead of 1.