Understanding the VBOMesh and mapping Buffers process


I am new to Cinder and looking through the source code to figure out what it is doing as best as I can. I am curious about the steps taken during the creation of a Batch.

To me the process seems quite complicated so I am wondering if someone can explain the logic to me.

Specifically things get confusing to me during the VboMesh creation.

For a VboMesh, I would assume we are essentially trying to map our Source Geometry attributes into one or more VBOs (contained in the mesh).

As I understand it, after the VboMesh's vertexArrayVbos member has been filled out the VboMesh has a vector of {layout, VBO} pairs where the layout describes the attributes which will go in the VBO.
The VBO part of the pair at this point is allocated but does not contain the actual attribute data.

I would assume at this point we should copy the data from the source into the VBO of the VBOMesh.

However, (and I am referring to line 341 in VboMesh.cpp) what happens is a VboMeshGeomTarget is made, the source is copied into that Target, and then the targets buffers are copied into glBufferData.

My question is, what is the need for the “VboMeshGeomTarget”, why not just fill the VBOMesh’s VBOs with data directly? Why the need for this sort of proxy target and the related calls to memcpy etc?


I don’t have the answer, but I’m quite curious to find it as well… anyone?