what you ask for is called the index buffer, since you have 8 vertices defined for the cube, you will have to draw with the help of array indexes vertices , and for example the mode GL_TRIANGLE_STRIP
each 4th row of indices defines one face of the cube with two triangles for which two vertices will be common.
the cube has 6 faces, therefore 4*6 = 24 indices are necessary.

depending on the order in which the positions of each vertex are written in the vertices array, the indices in the indices array will depend, ie for your case there will be something like
GLushort indices[] = { 0, 3, 1, 2, // нижняя грань 2, 6, 3, 7, // левая грань //... остальные 4 попытайтесь сами определить // обход против часовой стрелки по дефолту }; //... // далее в цикле отрисовки glDrawElements(GL_TRIANGLE_STRIP, sizeof(indices)/sizeof(GLushort), GL_UNSIGNED_SHORT, 0);
verticesforming the faces of the cube with the help of 2 triangles and 4 vertices. - ampawd