Graphics Reference
In-Depth Information
For these reasons, and in order to get the best of typed arrays and GL worlds,
vertex attributes and indices wrap buffer views as follows:
{ ”bufferView” : ”bufferView 29” ,
”byteOffset” :0,
”byteStride” :12,
”count” : 2399,
”type” : ”FLOAT VEC3”
}
Finally, it's up to the runtime engine to define how buffers are loaded, e.g.,
using multiple accesses to files at different offset for progressive loading or by
loading all data at once. The number of external files storing buffers is up to the
content pipeline.
The same flexibility applies to the way GL resources are created. It's up to
the engine to create a vertex buffer that contains all the attributes of the scene
or to create multiple buffers. bufferView s and their wrappers allow adapting any
resource management scheme.
2.6 Code Flow for Rendering Meshes
In glTF, a mesh is simply an array of primitives to be rendered. A primitive
specifies its type, matching the GLenum type used by drawElements ;indices;a
material; and vertex attributes, which are shared for a given mesh. This design for
meshes is due to modeling tools grouping primitives that share vertex attributes
into a single mesh.
Special care is made to make sure that the “flow” of glTF maps well with the
“code flow” when implementing using a GL API. For meshes, Figure 2.4 shows
how glTF properties map to actual GL APIs concepts.
For clarity, Figure 2.4 omits reordering primitives to render opaque primitives
before primitives requiring blending. Next we look at materials, techniques, and
passes. By implementing them, rendering order comes naturally.
2.7 From Materials to Shaders
Modern GL APIs require binding a program and setting up shaders. Here, we
walk through the layers between materials at the highest level and programs at
the lowest levels.
Most shaders take uniform inputs. At the highest level, these values come
from parameters within materials. To specify which implementation of shaders
these parameters should use, a material refers to a technique. This design allows
multiple materials to share the same technique. Thus, multiple materials are
Search WWH ::




Custom Search