I am trying to understand how “mesh buffers” work under the hood, and had a few concerns regarding reading & using them.

I have been told that the *mesh buffer* (`Mesh.getBuffer(VertexBuffer.Type)`

) is a collection of associated arrays, where each component array represents a different attribute for a different vertex in the mesh. So for instance, if the `Mesh`

is super-simple and has only 3 vertices in it, and *if* my understanding of mesh buffers is correct, then I would expect this `Mesh`

instance’s mesh buffer to exhibit the following characteristics:

- It would contain lots of different types of component arrays (each representing different attributes,
`Position`

,`Color`

,`Normals`

, etc.); and - Each of these component arrays would contain 3
*entries*in them, one for each vertex in the mesh

By “entries”, I don’t mean array *elements*, rather, collections of elements where each collection represents all the data necessary to represent the info for a particular vertex’s attribute. **So (1) let me start by asking that if any of this is incorrect, please begin by correcting me!!!**

Assumung I’m correct, then I’m particularly interested in two of these component arrays, `Position`

and `Color`

.

The Javadoc description for `Position`

states:

Position of the vertex (3 floats)

And the Javadoc description for `Color`

states:

Color and Alpha (4 floats)

So for the `Position`

component array, I’m assuming that each *entry* consists of 3 floats, and that each float represents a respective Cartesian axis value (`x`

, `y`

or `z`

). And for `Color`

I’m assuming each *entry* consists of 4 floats, where each float represents a red, blue, green or alpha value (RGBA). If this is correct, and if my previous understanding of mesh buffers (above) is correct, then using our super-simple 3-vertex mesh example, I would expect the `Position`

and `Color`

component arrays to look like the following:

- Position array:
- Size = 3 vertices * 3 floats/vertex = 9 (float) elements
- Elements 0 - 2 represent (x,y,z) values for Vertex #1
- Elements 3 - 5 represent (x,y,z) values for Vertex #2
- Elements 6 - 8 represent (x,y,z) values for Vertex #3
- Hence, if I did a
`mesh.getBuffer(VertexBuffer.Type.Position).getData()`

, I’d get a`FloatBuffer`

containing 9 floats in it, structured exactly as I have described above

- Color array:
- Size = 3 vertices * 4 floats/vertex = 12 (float) elements
- Elements 0 - 3 represent RGBA values for Vertex #1
- Elements 4 - 7 represent RGBA values for Vertex #2
- Elements 8 - 11 represent RGBA values for Vertex #3
- Hence, if I did a
`mesh.getBuffer(VertexBuffer.Type.Color).getData()`

, I’d get a`FloatBuffer`

containing 12 floats in it, structured exactly as I have described above

**(2) Can someone please (kindly) confirm/correct my understanding of the structure of these Position and Color component arrays here?** And if I’m completely wrong, maybe nudge me in the right direction? Thanks in advance

*enormously*!