A mesh is a collection of vertices
and triangles that define a polyhedral object, allocated on the
GPU upon which the renderer is executing. In practical terms, a
mesh is a pair
(a, i), where
a is an OpenGL
vertex buffer object consisting
of vertices of a
standard type,
i is an OpenGL
element buffer object consisting
of indices that describe how to draw the mesh as a series of triangles.
A mesh consists of
vertices.
A vertex can be considered to be a value of a
record type, with the fields of
the record referred to as the attributes
of the vertex. In the io7m-r1 package,
an array buffer containing vertex data is specified using the
array buffer types from
jcanephora.
The jcanephora package
allows programmers to specify the exact types of array buffers,
allows for the full inspection of type information at runtime, including
the ability to reference attributes by name, and allows for type-safe modification
of the contents of array buffers using an efficient cursor interface.
In the io7m-r1 package,
meshes must have at least the following attributes, in any order:
The reason for this is that, for example, many skeletal animation systems
store extra information in each vertex about the bones that influence said vertex.
If the package did not ignore this extra data, then programmers would be forced
to allocate whole new meshes and copy out only the attributes given above.