EduGraf Tutorial: Non-indexed geometries

Show a tetrahedron

In this tutorial, we want to learn more about creating geometries, i.e. object shapes that we can define freely. We start from the "hello triangle" program given in the Get Going section.
A shape or geometry is consists of triangles. Each triangle consists of three vertices, three edges and the face they contain. Any non-trivial shape consists of many triangles that make up its surface. EduGraf directly passes on the OpenGL non-indexed triangle mesh model to the programmer, which is explained in the following paragraph.
A single an array of float numbers fully defines a triangle mesh . At the most basic level it is interpreted as list of float-triples: each triple defines a position with x, y and z coordinates. On top of that, each consecutive triple of positions is interpreted as positions of a triangle's vertices. Thus, on top-level the array is interpreted as a list of triangles. Define the positions in the objects own coordinate system also known as model space. It is good practice to use numbers in the interval from -1 to 1 for all coordinate components.
The "hello triangle" program already uses this method of defining an objects geometry. Let us turn the flat triangle into a tetrahedron. We can thus simply change its Positions field with our intent according to the just explained rules. The rest of the program can remain unchanged. You can hit the "G" key when running the program. This just shows the triangle edges instead of the faces making it easier to check if the geometry is indeed flawless.
private static readonly float[] Positions = [ // x, y, z, -1, 0,-1, // ground +1, 0,-1, +1, 0, 1, -1, 0,-1, +1, 0, 1, -1, 0, 1, -1, 0,-1, // front +1, 0,-1, +0, 1, 0, +1, 0,-1, // right +1, 0, 1, +0, 1, 0, +1, 0, 1, // back -1, 0, 1, +0, 1, 0, -1, 0, 1, // left -1, 0,-1, +0, 1, 0, ];